This is real Python, running in your browser. Press ▶ Run below. The first run takes a few seconds while Python loads.
# Marks as a bar chart. Change a number
# or the name, then press Run again.
name = "Asha"
marks = {"Maths": 72, "Physics": 85,
"Coding": 93, "English": 64}
print("Report for", name)
for subject, mark in marks.items():
bar = "█" * (mark // 5)
print(f"{subject:8} {mark:3} {bar}")
average = sum(marks.values()) / len(marks)
print("Average:", round(average, 1))
print("Best:", max(marks, key=marks.get))
Now change it
- Press Edit, change Coding's
93to40, and run it again. Which subject is best now? - Add another subject inside the
{ }, such as, "Chemistry": 78straight after English's mark. - Broke it? Read the last line of the error to see what went wrong, or press Reset to start again.
Every course here works the same way: a short explanation, then real programs you can run and change.