227k views
2 votes
Create a program in Python that prompts the user to enter an integer number within the range of 1 to 10 inclusive. The program should display “correct input” if the input is within the given range else it should display “wrong input”.

2 Answers

2 votes

Answer:

dont know if it works!

Step-by-step explanation:

input=(input("enter number")

if input > 1

print("correct input")

if input <10

print("correct input")

else

print("wrong input")

User AutomaticStatic
by
3.5k points
2 votes

Python Code with Explanation:

# create a function named func to implement the required logic

def func():

# get the input from the user and store it in a variable named number

number = int(input("Please enter an integer between 1 to 10 inclusive\\"))

# if the input number is equal or greater than 1 and equal to 10 or less then the input is correct

if number>=1 and number<=10:

# print correct input

return print("Correct input")

# else the input is wrong

else:

# print wrong input

return print("Wrong input")

# call the function func

func()

Output:

Test 1:

Please enter an integer between 1 to 10 inclusive

4

Correct input

Test 2:

Please enter an integer between 1 to 10 inclusive

0

Wrong input

Test 3:

Please enter an integer between 1 to 10 inclusive

11

Wrong input

Create a program in Python that prompts the user to enter an integer number within-example-1
Create a program in Python that prompts the user to enter an integer number within-example-2
Create a program in Python that prompts the user to enter an integer number within-example-3
User Chethan Shetty
by
3.2k points