CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List
Python Code Walkthrough #51

Assign And Test In One Step

mediumOperators

📄 Code

Read carefully — what does this print?
1values: list[int] = [3, 8, 2, 9, 1]
2i: int = 0
3total: int = 0
4while (n := values[i]) < 9:
5 total = total + n
6 i = i + 1
7print(n, i, total)

🎯 Your Answer