(Python)Write an expression using Boolean operators that prints "Eligible" if user_age is greater than 17 and not equal to 25.


Sample output with input: 17

Ineligible

Respuesta :

user_age = input("Input Age: ")

if int(user_age) <= 17:

   print("Ineligible")

elif int(user_age) == 25:

   print("Ineligible")

else:

   print("Eligible")

:Here is some basic code.  It takes an input, turns it into an int type value, and checks the parameters that you gave me.  It errors out when you put in anything but a number.

Answer:

user_age = int(input())

if (user_age > 17) and (user_age != 25):

   print('Eligible')

else:

   print('Ineligible')

Explanation:

the code is very easy to do because it asks for it in Boolean operators.  So user_age = int(input()) ## asks for user input

then it checks the status by seeing if the number is greater than 17 and not equal to 25.  we know that > is greater and we know that != means not equal.  Therefore, this will rule out both and then give the eligible or ineligible statement.