cs/Practical File/question_15_output.txt
Neil Revin cc8b0efe94
feat: add practical file projects
Signed-off-by: Neil <neil@willofsteel.me>
2025-06-24 02:28:22 +05:30

21 lines
446 B
Plaintext

Question 15:
Write a Python program to accept age and check whether the person is eligible to vote (18 or older).
Answer:
def main(age: int) -> None:
if age >= 18:
print(f"Age {age} is eligible to vote.")
else:
print(f"Age {age} is not eligible to vote.")
if __name__ == '__main__':
main(18)
main(17)
main(20)
Output:
Age 18 is eligible to vote.
Age 17 is not eligible to vote.
Age 20 is eligible to vote.