Advertisement
isimpforobama

NumberCounter

Mar 18th, 2022
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. def Count(): # Define Function
  2.     try:
  3.         countt = 0 #Define Count
  4.         num1 = int(input('Enter First Num: '))# Getting User
  5.         num2 = int(input('Enter Second Num: ')) #  Input
  6.         # while is true when first number is less than second number
  7.         while num1 < num2:
  8.             if num2 <= 10000:
  9.                 num1 += 1 # adding 1 to first number aka num1
  10.                 countt += 1 # adding 1 to the count
  11.                 print(num1)
  12.             if num2 >= 15000:
  13.                 num1 += 1 # adding 1 to first number aka num1
  14.                 countt += 1 # adding 1 to the count
  15.             # Some error Fixes
  16.             if num1 > num2:
  17.                 print("First Number must be Less than the Next or Equal to")
  18.                 break
  19.              # Printing the Result
  20.             if num1 == num2:
  21.                 print(countt)
  22.                 break
  23.      # Some error Fixes
  24.     except ValueError:
  25.         print("Input must be A number")
  26.     except KeyboardInterrupt:
  27.         print("Stopped")
  28.         exit
  29. Count() # Just Running The Function you can just delete this if you are importing this script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement