Advertisement
EthPunch

Number Counter 1.2 - Some strange errors with negative nums!

Jul 28th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.88 KB | None | 0 0
  1. # By EthPunch
  2. '''
  3. Hi, I'm a beginner with Python and this is one of my first full creations. You basically have a start and a finish integer and the program will count between them. For some reason, anything below -5 drives the program insane. If you know why, then please let me know.
  4. '''
  5. def tuna(testvariable):
  6.     print("\nHey, welcome to EthPunch's Python Number Counter!")
  7.     start = int(input("Please enter the number you wish to start at: "))
  8.     print(start, " - cool. Now enter the number you want to finish at: ")
  9.     end = int(input())
  10.     print("So we're starting at ", start, " and we're ending at ", end, ". Please press '0' to continue, or '1' if you've made a mistake typing.")
  11.     cucumber = int(input())
  12.     if cucumber is 0:
  13.         decider(start, end)
  14.     elif cucumber is 1:
  15.         beef(testvariable)
  16.     else:
  17.         print("Hey, it looks like you didn't enter a correct number. Let's go back to the beginning.")
  18.         beef(testvariable)
  19.  
  20. def beef(testvariable):
  21.     tuna(testvariable)
  22.  
  23. def decider(start, end):
  24.     if start < end:
  25.         NormalCounter(start, end)
  26.     elif end < start:
  27.         backwardsCounter(start, end)
  28.     elif start is end:
  29.         samesame(start)
  30.  
  31. def NormalCounter(start, end):
  32.     end = end + 1
  33.     for bacon in range(start, end):
  34.         print(bacon)
  35.     print("Done :)")
  36.  
  37. def backwardsCounter(start, end):
  38.     cheese = True
  39.     num = start
  40.     while cheese is True:
  41.         print(num)
  42.         num = num - 1
  43.         if num is (end - 1):
  44.             print("Done :)")
  45.             break
  46.         else:
  47.             continue
  48. def samesame(start):
  49.     print("Are you trying to trick me? Because I'm not counting from ", start, " to ", start, ".\nI'm gonna go eat some beef and we'll start again.")
  50.     beef(testvariable)
  51.  
  52. def testFunction():
  53.     print("testFunction seems to be working")
  54.  
  55. testvariable = 123
  56. tuna(testvariable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement