← Back to Basics

Top Players

6 of 8

Exercise 7: Top Players πŸ†

πŸ”‚ For Loops

Your Task

Part A:

players = ["Steve", "Alex", "Notch", "Jeb", "Dinnerbone"]

Use a for loop to print the first 3 players with medals (πŸ₯‡ πŸ₯ˆ πŸ₯‰)

Part B:

scores = [100, 150, 200, 250, 300]

Use a for loop to print each score. Then print the total.

Part C: Make a countdown from 5 to 1, then print "GO!"


Example Output

=== Top 3 ===
πŸ₯‡ Steve
πŸ₯ˆ Alex
πŸ₯‰ Notch

=== Scores ===
100
150
200
250
300
Total: 1000

=== Countdown ===
5
4
3
2
1
GO!

Try it yourself

Code: Top Players

Loading Python runtime…
Python …
Loading...
bash
$ Click "Run" to execute your code...