Write a program in Python programming language, which allows the user to input a number and upper limit, and based on the input values, the program should perform the following tasks:
⦁ Check whether the value entered by the user is a positive integer.
⦁ Generates an error massage in case of negative integer.
⦁ Generate a table of given number.
⦁ Upper limit for table will be get from user.
def main():
try:
digit = int(input('Enter a number: '))
upper_limit = int(input('Enter a upper limit: '))
if digit < 0 and upper_limit < digit:
print('the number must be greater than zero')
main()
for i in range(digit, upper_limit + 1):
print(i)
except ValueError:
print("it's not a number")
main()
main()
Comments
Leave a comment