Conditional Statement Practice Question - II ( DS150423 )

  1. Take an input (age) from user and accordingly check and specify if the user is eligible to vote or not.
  2. Take an input (int) from user and accordingly check and specify if the input is within the range of 10 - 100.
1 Like

age = int(input("Enter your age: "))

if age >= 18:
print(“You are eligible to vote.”)
else:
print(“You are not eligible to vote.”)

if age >= 10 and age <= 100:
print(“Your age is within the range of 10-100.”)
else:
print(“Your age is outside the range of 10-100.”)

2 Likes

age = int(input("Enter age : "))
if age >= 18:
print(“Eligible for Voting!”)
else:
print(“Not Eligible for Voting!”)
output1:-
Enter age : 20
Eligible for Voting!
output2:-
Enter age : 18
Eligible for Voting!
output3:-
Enter age : 17
Not Eligible for Voting!

2 Likes
  1. Eligibility-
    age = int(input("Enter Age : "))
    if age>=18:
    status=“Eligible”
    else:
    status=“Not Eligible”
  2. Range-
    no = int(input("Enter any number between 10-100 : "))
    if no >= 10 and no <= 100:
    print(“Number in range 10-100”)
    else:
    print("Number not found )
2 Likes

2 Likes

age = int(input("Enter your age : "))
if age >= 18:
print(“your are eligible to vote.”)
else:
print(“your are not eligible to vote.”)

num = int(input("Enter any number: "))
if num >= 10 and num <= 100:
print("Number in range 10-100: ",num)
else:
print(“Number is not in range:”,num)

2 Likes

persons_age = int(input('\nWhat is your age? '))
if persons_age >= 18:
vote = ‘eligible’
else:
vote = ‘Not eligible’

print(‘\nYou are’, vote, ‘to vote\n’)

user_age = int(input(‘\nWhat is your age? ‘))
if user_age >= 10 and user_age <= 100:
describe = ‘in’
else:
describe = ‘not in’
print(’\nYour age is’, describe, ‘the range 10 to 100\n’)

1 Like

age = int(input("The age of a person is : "))

if age >= 18:
print(“Eligible for Voting!”)
else:
print(“Not Eligible for Voting!”)

num = int(input("Enter any number: "))
if num >= 10 and num <= 100:
print("Number is present in the range of 10-100: ",num)
else:
print(“Number is not present in range of 10-100:”,num)

out put:
The age of a person is : 18
Eligible for Voting!
Enter any number: 18
Number is present in the range of 10-100: 18

1 Like

Question 1 :

age = int(input("Enter the age of person : "))
if age>=18 :
print(“Person is eligible to vote.”)
else :
print(“Person is not eligible to vote.”)

Screenshot (328)

Question 2 :

no = int(input(“Enter any integer value : “))
if 10<=no<=100:
print(no,” lies in the range 10 - 100.”)
else:
print(no, " does not lies in the range 10 - 100.")

Screenshot (329)

1 Like

num1 = int(input(“enter the age”))
if num1>10 and num1<100:
print(“number lies inside the range 10 and 100”)
if num1<18:
print(“not eligible for voting”)

else:
   print("eligible for voting")

else:
print(“Not in the range between 10 and 100”)

if int(input('Please Enter Your Age: ')) in range(10, 100):
print(‘Eligible’)
else:
print(‘Not Eligible’)

#question 1

age = int(input("Enter the age of person : "))
if age>=18 :
print(“Person is eligible to vote.”)
else :
print(“Person is not eligible to vote.”)

question 2

user_age = int(input(‘What is your age? ‘))
if user_age >= 10 and user_age <= 100:
value = ‘in’
else:
value = ‘not in’
print(’Your age is’, value, ‘the range 10 to 100\n’)