Jul 4, 2024
Download Python: Go to python.org -> Downloads -> Latest Version
Install Code Editor: PyCharm (jetbrains.com/pycharm)
print("Hello World")
print: Function to output textage = 20
print(age)
False vs falsename = input("What is your name?")
print("Hello " + name)
input() function to read terminal input+int(), float(), bool(), and str()
year = int(input("Birth year?"))
age = 2020 - year
print(age)
.upper(), .lower(), .find(), .replace(), in operator+, -, *, /, //, %, **
%: Returns remainder**: Power calculation+=, -=, *=, /=, //=, %=, **=**>, >=, <, <=, ==, !=and, or, notif 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(5):
print(number)
names = ["John", "Bob", "Marsh"]
print(names[0]) # Access first element
``
.append(), .insert(), .remove(), .clear()names[0:2]for item in namesnumbers = (1, 2, 3)
numbers[0].index(), .count()codewithmosh.com