take input of age of 3 people by user and determine oldest and youngest among them.Write python code
Answers
Explanation:
Take input of age of 3 people by user and determine oldest and youngest among them. ... But it keeps crashing the program. ... Read the comments in the code: #include <stdio.h> main () { int a,b,c; printf("\nType the ages of a,b,c:"); //correct format of scanf scanf("%d %d %d",&a,&b ... Shallow Copy and Deep Copy in Python.
Answer:
Explanation:
fp=eval(input("Enter age of first person:"))
#fp stands for first person
sp=eval(input("Enter age of second person:"))
#sp stands for second person
tp=eval(input("Enter age of third person:"))
#tp stands for third person
if( fp <sp <tp):
print("First person is youngest")
print("Third person is oldest")
elif((fp > sp < tp)&(fp < tp )) :
print("Second person is youngest")
print("Third person is oldest")
elif ((fp > sp < tp)&( fp > tp)):
print("Second person is youngest")
print("First person is oldest")
elif ((fp < sp > tp)&( fp > tp)):
print("Second person is oldest")
print("Third person is youngest")
elif ((fp < sp > tp)&( tp > fp)):
print("Second person is oldest")
print("First person is youngest")
else:
print("Third person is youngest")
print("First person is oldest")