Answer to Question #348605 in Python for Talha

Question #348605

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.



1
Expert's answer
2022-06-06T15:01:02-0400
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()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS