0

Need help in python exercise I am stuck thanks

Exercise #1: Step 1: Input user 1's name Step 2: Input user 1's age Step 3: Input user 2's name Step 4: Input user 2's age Expected Result: Print which user is younger and how many years is the gap. 0 age difference should also be handled. Invalid entry should also be validated like non-numeric or float entry for age. After displaying the result, user should be asked Y/N if she wishes to exit. If Y, print "Bye" if N, step 1-4 should be repeated Note: Input should be case insensitive i.e. "y" or "n" should also be accepted.

12th Jul 2021, 8:23 AM
Michael Reyes
Michael Reyes - avatar
7 Answers
+ 7
Michael Reyes You should use if else here .....
12th Jul 2021, 9:51 AM
Pallavi Bhardwaj
Pallavi Bhardwaj - avatar
+ 2
Can you please show your attempt?
12th Jul 2021, 8:27 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Michael Reyes you should go through the python course and learn about some basic concepts like 'if else', 'while' loop and so on.
12th Jul 2021, 9:06 AM
Abhay
Abhay - avatar
0
switch case,if...else.
12th Jul 2021, 8:29 AM
VuxxLong
VuxxLong - avatar
0
I am still a newbie this is what I am typing so far... variable_name = input("please enter your name: ") print(User 1 variable_name) age = input(Please enter your age) variable_name = input("please enter your name: ") print(User 2 variable_name) age = input(Please enter your age)
12th Jul 2021, 8:32 AM
Michael Reyes
Michael Reyes - avatar
0
thanks abhay will do just that
12th Jul 2021, 9:16 AM
Michael Reyes
Michael Reyes - avatar