2 weeks ago
19 lines354 B
# Sum up a shopping list | |
prices = [2.49, 0.99, 5.25, 3.10] | |
total = 0 | |
| |
for price in prices: | |
total += price | |
| |
print(f"Total: {total:.2f}") # Total: 11.83 | |
| |
# Count down with while | |
seconds = 3 | |
while seconds > 0: | |
print(seconds, "...") | |
seconds -= 1 | |
print("Go!") | |
| |
# See the lesson README for what to try next. | |
| |
# Questions? Ask in the course forum. |