Advertisement
Guest User

PrintingBsFromGroceryList.py

a guest
Jun 18th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #This brings in the timing machinism that helps time out the printing.
  2. import time
  3.  
  4. #Prints out an introduction
  5. print ("I love lists, don't you?'")
  6.  
  7. #Names the list and what contents are in the list.
  8. list = ["Apples", "Oranges", "Broccoli"]
  9.  
  10. #Prints the list.
  11. print (list)
  12.  
  13. #Prints the Names of anything in list that starts with the letter "B".
  14. BList = [title for title in list if title.startswith("B")]
  15.  
  16. #Prints the list in time.
  17. print ("Here it comes.")
  18. time.sleep (0.5) # Here's the amount of time it waits.
  19. print (".")
  20. time.sleep (0.5)
  21. print (".")
  22. time.sleep (0.5)
  23. print (".")
  24. time.sleep (1)
  25.  
  26. #Prints the item in list that starts with "B"!
  27. print (BList)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement