166k views
15 votes
The following code will not compile. Which of the options below would allow the code to compile and run as intended?

if (x >= -10 and <= 10):
print("In range")

1 Answer

8 votes

Answer:

Follows are the code to this question:

x=int(input())#use input method with int that takes integer value from user-end

if (x >= -10 and x<=10):#defining if block that checks x in between -10 to 10

print("In range")#print message

Output:

6

In range

Explanation:

In this code, the choices were missing that's why the solution to this question can be defined as follows:

In this, x variable using the input method with the int, which takes integer value from the user-end. In the next step, the if block is used, that checks x value lies on between the -10 to 10, to check this condition it used the and logical operator, that run the code when both conditions are true, and at last, it prints the message "In range".

User Pieca
by
3.5k points