Print Grandson's Name
Coding Problem Keys
Print Grandson's Name
Problem Statement
The program must accept the first and last names of three persons who are in a family tree and print the grandson's name.
Note: The last name of a person is nothing but the father's first name.
Boundary Condition(s)
Length of first and last names are from 3 to 100.
Input Format
The first line contains the first and last name of person 1 separated by a space.
The second line contains the first and last name of person 2 separated by a space.
The third line contains the first and last name of person 3 separated by a space.
Output Format
The first line contains the first and last name of the grandson separated by a space.
Example Input/Output 1
Input
Arun Kumar
Swamy Nathan
Kumar Swamy
Output
Arun Kumar
Note: Max Execution Time Limit: 5000 millisecs
Solution
Programming Language: Python 3 Language
l=[input().split() for i in range(3)]
f=[i[0] for i in l]
s=[i[1] for i in l]
for i in range(3):
if f[i] not in s:
print(f[i],s[i])
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments