Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If Else Statements: Question 6 : ( 2 5 ) a . Ask the user to input his / her age. Check whether the age

If Else Statements:
Question 6: (25)
a. Ask the user to input his/her age. Check whether the age is equal to or greater than 18. if so, print You can vote . If not, print Sorry, you are not eligible .(hint: remember that Python firsts takes user input as string type. So, you may have to change it to numerical type by using int or float function.
b. Can you modify the program such that if the age is not 18 yet than the program prints You have to wait X years ? Where X is the number of years left for the user to be 18.
Use the following Syntax to write if-else code:
If (condition):
Value if True
else:
Value if False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions