Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count=0
- shopping=["bread", "cheese", "apple", "tomato", "biscuits" ]
- for item in shopping:
- count=count+1
- print (item)
- print("You have " + str(count) + " items in your shopping list")
- #so I've not told it how many times to run, it just runs the complete list
- #each item is printed and then the program stops
- #now we will count the items on the list and print the total at the end of the program.
- #at the top of the program, create a variable called count and set to zero
- #then add the extended print line, NOT indented AND NOT forgetting that count has to be
- #converted into a string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement