Quiz: At Least 30 Minutes
Reading code before you run it is a check too. Say what you think it prints, then run it: if the two differ, the code or your reading is wrong, and either is worth knowing. Someone asked an AI for a function that counts the walks of at least 30 minutes, and this is the answer they got. Read it without running it. What does it print?
1def long_walks(walks):
2 count = 0
3 for minutes in walks:
4 if minutes > 30:
5 count += 1
6 return count
7
8print("Walks:", long_walks([30, 45, 20, 60]))
9