Write pseudo code that performs the following: Ask a user to enter a number. If the number is between 0 and 10, open gate 1. If the number is greater than 10 and less than 21, open gate 2, else prompt a message notifying that the gate 3 is not operational/try again later.

Respuesta :

Answer:

Step-by-step explanation:

# Pseudocode for gate control based on user input

# Ask the user to enter a number

user_input = input("Please enter a number: ")

# Convert the user input to an integer

try:

   number = int(user_input)

except ValueError:

   print("Invalid input. Please enter a valid number.")

   exit()

# Check if the number is between 0 and 10

if 0 <= number <= 10:

   print("Opening Gate 1")

elif 10 < number < 21:

   print("Opening Gate 2")

else:

   print("Gate 3 is not operational. Please try again later.")

Otras preguntas