Aug 7, 2024
hello_world
).app.py
).print("Hello World")
age = 20
print(age)
.age = 30
age = 20
).price = 19.95
).first_name = "Mosh"
).is_online = True
).input()
function for user input:
name = input("What is your name? ")
print("Hello " + name)
.int()
, floats with float()
, and vice versa with str()
.birth_year = int(input("Enter your birth year: "))
age = 2020 - birth_year
print(age)
+
(addition), -
(subtraction), *
(multiplication), /
(division)./
for float results.//
for integer results.%
: gives remainder.**
: raises to power.>
, <
, >=
, <=
, ==
, !=
.and
, or
, not
.if temperature > 30:
print("It's a hot day")
elif temperature > 20:
print("It's a nice day")
else:
print("It's cold")
i = 1
while i <= 5:
print(i)
i += 1
for number in range(1, 6):
print(number)
names = ["John", "Bob", "Mosh"]
append()
, insert()
, remove()
, and clear()
.