Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # counter2.py
- # Counter
- #
- # Computer counts from user's chosen starting number
- # to user's chosen ending number by the amount the user chooses to count
- #
- # Heidi Heffelfinger
- # November 11, 2012
- # Programming Python for the Absolute Beginner 3rd Ed. Chapter 4
- # Challenge 1
- # welcome user
- print("\n\t\tWelcome to The Counter\n")
- # get starting number
- starting = int(input("Which number would you like to start counting at: \n"))
- # get ending number
- ending = int(input("Which number would you like to count to: \n"))
- # get how much to count by
- count_by = int(input("What number would you like to count by (ie: 1, 2, 5, etc...): \n"))
- # count
- print("The computer will count from", starting, "to", ending, "by", count_by, ":")
- for i in range(starting, (ending + 1), count_by):
- print(i, end=" ")
- input("\n\nPress the enter key to exit.\n")
Advertisement
Add Comment
Please, Sign In to add comment