Advertisement
Davidgdavid

Untitled

Apr 24th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. # Create and emty new list
  2. shopping=[]
  3. #Input how many items and convert from string to integer
  4. list=input("How many items on your shopping list")
  5. list=int(list)
  6. #add the items sequentially by cycling through
  7. for item in range(list):
  8. goods=input("What do you want to add to the list? ")
  9. shopping.append(goods)
  10. # calculate the number of items in the list and convert from interger to string
  11. number=len(shopping)
  12. number=str(number)
  13. #print the shopping listprint(shopping)
  14. print("There are "+number+" items in my shopping basket")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement