Move python question files to 'questions' directory Move output files to 'outputs' directory Copy output files to 'questions' for ease of viewing Signed-off-by: Neil <neil@willofsteel.me>
21 lines
446 B
Plaintext
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.
|