SHARE
TWEET

Untitled

Davidgdavid Apr 24th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top