Numbers and strings
Numbers can be whole (int) or fractional (float). Operators: + - * /, integer division //, remainder %, power **.
print(7 // 2) # 3
print(7 % 2) # 1
print(2 ** 10) # 1024
Strings (str) go in quotes. Get a character by its index starting at zero; split() cuts a string by spaces:
word = "Python"
print(word[0], word[-1]) # P n
print("one two".split()) # ['one', 'two']
f-strings put values right into text:
name, score = "Anna", 95
print(f"{name} scored {score} points")
Starter functions
From this topic on, many challenges come with a def name(...): stub. Write your code inside it and give back the answer with return — functions are covered in detail later.