[Solved] Minimum and Maximum with Python

Minimum and Maximum: The ExConFair is the region’s largest trade fair on Construction Equipments & Technology. The Event organizers hired college students as volunteers to work at the fair as the event is targeted to be attended by approx. 30 million visitors.

At the Office in the fair, there are two guards who count how many times a volunteer enters into the fair ground. Though the duty of a guard is 24 hour in a day, but sometimes they fall asleep during their duty and could not track the entry of volunteers in the fair ground. But one better thing is that they never fall asleep at the same time. At least one of them remains awake and counts who enters into the office. Now the Event Head wants to calculate how many times a volunteer has entered into the fair ground. He asked to the guard and they give him two integers A and B, count of first guard and second guard respectively.
Help the Event Head to count the minimum and maximum number of times a volunteer could have entered into the fair ground.

Input Format:
First line of the input consists of two integers that correspond respectively to A and B.

Output Format:
Output a single line containing two space separated integers, the minimum and maximum number of times a volunteer could have entered into the fair ground.
Refer sample input and output for formatting specifications.

Sample Input 1:
19 17

Sample Output 1:
19 36

Sample Input 2:
30 40

Sample Output 2:
40 70

Solution

n = input().split()
n1 = int(n[0])
n2 = int(n[1])

if n1<n2:
    print(n2," ",(n1+n2))
else:
    print(n1," ",(n1+n2))

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

πŸ“Œ Nodejs and Android 😎
πŸ“Œ Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *