Skip to content Skip to sidebar Skip to footer

Beginner Python Program Using Count-based Iteration Structure

I am in a beginner Python programming class and we were to write a program that generates an item description, it's price, and the total. The program I originally wrote used LISTS

Solution 1:

I concur with Mark Meyer: the assignment does not specify the input. You've done well enough with your programming style. Given the restrictions, I suggest only a couple of improvements:

  • Use a running total variable for the sum.
  • Give it a meaningful name. x, y, z are meaningless.

Here, the running tally would look something like:

total = 0
total += fish
total += corn
...

Post a Comment for "Beginner Python Program Using Count-based Iteration Structure"