Aug 1, 2024
print("Hello World")
age = 20
print(age)
input()
to read values from the terminalname = input("What is your name? ")
print("Hello " + name)
int()
to convert to integerfloat()
to convert to floatstr()
to convert to stringif
, elif
, and else
for decision makingif temperature > 30:
print("It's a hot day")
elif temperature > 20:
print("It's a nice day")
else:
print("It's a cold day")
while
loop example:
i = 1
while i <= 5:
print(i)
i += 1
for
loop example to iterate over a list
for item in names:
print(item)
names = ["John", "Bob", "Mosh"]
append()
, insert()
, remove()
, clear()
, and in
operatorlen(list)
numbers = (1, 2, 3)