HeidiHeff

Counter

Nov 11th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. # counter2.py
  2. # Counter
  3. #
  4. # Computer counts from user's chosen starting number
  5. # to user's chosen ending number by the amount the user chooses to count
  6. #
  7. # Heidi Heffelfinger
  8. # November 11, 2012
  9. # Programming Python for the Absolute Beginner 3rd Ed. Chapter 4
  10. # Challenge 1
  11.  
  12. # welcome user
  13. print("\n\t\tWelcome to The Counter\n")
  14.  
  15. # get starting number
  16. starting = int(input("Which number would you like to start counting at: \n"))
  17.  
  18. # get ending number
  19. ending = int(input("Which number would you like to count to: \n"))
  20.  
  21. # get how much to count by
  22. count_by = int(input("What number would you like to count by (ie: 1, 2, 5, etc...): \n"))
  23.  
  24. # count
  25. print("The computer will count from", starting, "to", ending, "by", count_by, ":")
  26. for i in range(starting, (ending + 1), count_by):
  27.     print(i, end=" ")
  28.  
  29. input("\n\nPress the enter key to exit.\n")
Advertisement
Add Comment
Please, Sign In to add comment