Aug 1, 2024
print("Hello World") to print to the terminal.age = 20print(age)age = 30
print(age)
name = "Mosh"is_online = Trueprice = 19.95input() to get user input from the terminal.name = input("What is your name?")
print("Hello " + name)
int(): Convert to integerfloat(): Convert to floatstr(): Convert to string+, -, *, /, % (modulus), ** (exponentiation)x = 10 + 3 * 2 # Operator precedence applies
+=, -=, *=, /=>, <, >=, <=, ==, !=and, or, notif price > 10 and price < 30:if condition:
# code block
else:
# alternative code block
if temperature > 30:
print("It's a hot day.")
i = 1
while i <= 5:
print(i)
i += 1
[ ].names = ["John", "Bob", "Mosh"]
print(names[0]) # Outputs: John
append(), insert(), remove(), clear(), len()numbers = (1, 2, 3)