Jun 27, 2024
print("Hello World")age = 20print(age)True or Falseprice = 19.95, first_name = "John"input Function: Reading input from terminalname = input("What is your name?")
print("Hello " + name)
int(x), float(x), bool(x), str(x).upper(), .lower(), .find(), .replace()in Operator: Check for substringscourse = "Python for Beginners"
print(course.upper())
+, -, *, /% (Remainder)**10 + 3
10 // 3
10 ** 3
>, <, >=, <=, ==, !=and, or, notprice = 25
print(price > 10 and price < 30)
if condition:
# block of code
elif condition:
# another block
else:
# default block
i = 1
while i <= 5:
print(i)
i += 1
for item in [1, 2, 3]:
print(item)
range Function:
for number in range(5):
print(number)
[].append(), .insert(), .remove(), .clear()()numbers = (1, 2, 3)
print(numbers[0]) # prints 1