Jayteepix

for loop with item count

Oct 29th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #Shopping List using for loop with counter modded to use "len90 function
  2. shopping = ["bread", "cheese", "milk", "weetabix", "wine"]
  3. ###count = 0
  4. for item in shopping:
  5. print(item)
  6. ### count = count + 1
  7. ###print("No. of items in basket : " + str(count))
  8. print("No. of items in basket : " + str(len(shopping)))
Advertisement
Add Comment
Please, Sign In to add comment