Posted on:

30 Apr 2023

0

Solution to Question #1

Fixing out a wrong input to Q1


num_1 = input("Enter the first number between 1 and 100 >> ")
num_2 = input("Enter the second number between 1 and 100 >> ")


if num_1.isdigit() and num_2.isdigit():
    if int(num_1)>100 or int(num_1)<1 or int(num_2)>100 or int(num_2)<1:
        print("Choosen numbers are out of range")
    elif int(num_1) >= int(num_2):
        print("First number must be greater than the second one")
    else:
        for i in range(int(num_1), int(num_2)+1):
            print(i, end=' ')
else:
    print("Enter a valid Integr")
0 answers ( 0 marked as helpful)

Submit an answer