'4.5.1 Detect Number Range Zybook

Write an expression that prints "Eligible" if user_age is between 18 and 25 inclusive. Ex: 17 prints "Ineligible", 18 prints "Eligible".

user_age = int(input())

if ''' Your solution goes here ''':
    print('Eligible')
else:
    print('Ineligible')

I keep putting (user_age <= 25) what am I doing wrong?



Solution 1:[1]

Here is the correct code for CHALLENGE ACTIVITY 5.2.1: Detect number range.

Write an expression that prints "Eligible" if user_age is between 18 and 25 inclusive.

Ex: 17 prints "Ineligible", 18 prints "Eligible".

user_age = int(input())

if user_age >= 18 and user_age <= 25 :
    print('Eligible')
else:
    print('Ineligible')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aaossa