Write a program in Python to read the name and age of a person and print the message
“You are eligible to vote” if his/her age is more than or equal to 18 otherwise print the
message “You are not eligible to vote”
Answers
Answered by
0
Answer:
In this example, the condition of the if statement is a == 2.
The body of the if statement consists of the statement print(“a is 2”). This statement will get executed only if the condition is True.
Since the value of the variable a is 2, the condition a == 2 became True and the statement body of if got executed and thus a is 2 got printed on the screen.
If the value of a was not 2, then the statement in the body of if would not have got executed.
Let’s take one more example.
Answered by
1
REFER TO THE ATTACHMENT.
Attachments:
Similar questions