Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shopping = ["bread","cheese", "apple","tomato","biscuits"]
- count = 0
- ## by using a counter
- for item in shopping:
- print(item)
- count = count + 1
- countString = str(count)
- print("You have "+ countString + " items in your shopping list.")
- ## by using str.len(object)
- print("You have "+str(len(shopping))+" items in your shopping list.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement