using python
Write a program that takes the name and age of the
user as input and displays a message whether the
user is eligible to apply for a driving license or not.
(the eligible age is 18 years).
Answers
Answered by
19
Answer:
name = input(“Enter your name: “)
age = int(input(“Enter your age: ”))
if (age >= 18):
print (name, “ is eligible to apply for driving license.”)
else:
print (name, “ is not Eligible to apply for driving licence.”)
Answered by
2
The python program is,
name = input("Enter your Name = ")
age = int(input("Enter your age = "))
print((name,"is eligible to apply for a driving license.") if age>17 else (name,"is not eligible to apply for a driving license."))
- Inside the print statement, the ternary operator is used.
- The Ternary operator is used to test any condition within a single line.
Similar questions