-
νμ΄μ¬ | #5 μ°μ°μμΉ΄ν κ³ λ¦¬ μμ 2023. 8. 18. 23:21
μ°μ μ°μ°μ
μ«μλΌλ¦¬ λνκ³ λΉΌκ³ κ³μ°ν λ μ¬μ©λλ μ°μ°μλ€.
a = 10 b = 5 print(a+b) #15 print(a-b) #5 print(a*b) #50 print(a/b) #2 print(a%b) #0
λμ μ°μ°μ
κ°μ λμ ν λ μ¬μ©νλ€.
# = μ°μ°μ x = 5 # += μ°μ°μ x += 1 # x = x + 1 # -= μ°μ°μ x -= 1 # x = x - 1 # *= μ°μ°μ x *= 1 # x = x * 1
λΉκ΅ μ°μ°μ
λ κ°μ λΉκ΅ν λ μ¬μ©νλ€.
x = 10 y = 5 z = 10 print(x == y) #false print(x == z) #true print(x != y) #true print(x > y) #true print(x < z) #false print(x <= z) #true
λ Όλ¦¬ μ°μ°μ
and, or, not μ°μ°μμ΄λ€.
a = 10 b = 5 print(a > 5 and b > 5 ) #false print(a > 5 or b > 5) #true print(not(b > 5)) #true
https://www.w3schools.com/python/python_operators.asp
Python Operators
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com