Variables and printing
python
name = "Fatmata"
age = 21
print(f"{name} is {age} years old")Lists and loops
python
scores = [85, 90, 78]
for score in scores:
print(score)
print("Average:", sum(scores) / len(scores))Functions and conditions
python
def grade(score):
if score >= 80:
return "A"
elif score >= 60:
return "B"
return "Keep going"
print(grade(85)) Tagspythondata
Practise the reference.
Open the compiler, paste one snippet, and change it until you understand what it does.
Related