Guest User

Untitled

a guest
Nov 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. #Simple Number Counter V2
  2. #My attempt at V1 didn't go so great.
  3. #It didn't stop counting!
  4. #Hopefully this one will turn out to be a success...
  5.  
  6. options = ["Yes", "No"]
  7.  
  8. def count():
  9.     print 'Welcome to my Number Counter!'
  10.     print 'What number would you like me to count to?'
  11.     x = int (raw_input("Enter: "))
  12.     number = 0
  13.     while number <= x:
  14.         print 'Number: ', number
  15.         number = number + 1
  16.     print 'Finished counting.'
  17.  
  18.     while True:
  19.         option = raw_input("Would you like to count to another number? (Yes/No) :")
  20.         if option == options[0]:
  21.             print x
  22.             break
  23.         elif option == options[1]:
  24.                 print '\n\nPress enter to close...'
  25.                 break
  26.         else:
  27.             print 'Enter a Number'
  28.             print 'Please note the number cannot contain digits!'
  29.  
  30. count()
Add Comment
Please, Sign In to add comment