Sep 16, 2024
Download Python
Install Code Editor
print() function:
print("Hello World")age = 20 (integer)price = 19.95 (floating-point number)first_name = "Mosh" (string)is_online = True (boolean value)input() function to receive user input:
name = input("What is your name?")+ operator.int(), float(), bool(), str()+, Subtraction -, Multiplication *, Division ///, Modulus %, Exponentiation **x += 3)***() to change evaluation order.>, Less than <, Equals ==, Not equals !=and, or, not for combining boolean expressions.if, elif, else for decision making.if temperature > 30:
print("It's a hot day")
elif temperature > 20:
print("It's a nice day")
else:
print("It's cold")
range(5) generates numbers 0 to 4.names = ["John", "Bob", "Mosh"]append(), insert(), remove(), clear()() to define.