We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcb2564 commit 9b4a8a2Copy full SHA for 9b4a8a2
300_Exercises/Simple/4.voting_eligible.py
@@ -0,0 +1,18 @@
1
+# Take age from user and check age is eligible for voting
2
+# Task 4:
3
+def voting_age(name,age):
4
+ if age >= 18 and age <= 100:
5
+ print(f'Hi {name}!. You are eligible for voting your age is {age}')
6
+ else:
7
+ print(f'Hi {name}!. You are not eligible for voting !!')
8
+
9
+try:
10
+ name,age=input('Enter the name and age with single whitespace: ').split(' ')
11
+ voting_age(name,int(age))
12
+except ValueError:
13
+ print('Enter the valid input')
14
15
+# Output:
16
+# Enter the name and age with single whitespace: Harrish 19
17
+# Hi Harrish!. You are eligible for voting your age is 19
18
0 commit comments