3

I have some question while doing some coding study.

task was:

receive 5 numbers in seperated lines.
pick smallest number among first 3 numbers
pick smallest number among last 2 numbers
add 2 picked numbers
add -50 to above result and print it

///e.g
500
700
600
160
270
/// will picked 500 and 160 and add those with -50 and will print
610

and here was my code to solve this problem.

a,b,c,d,e = int(input()), int(input()), int(input()), int(input()), int(input());
print(min(a,b,c)+min(d,e)-50);

and it works!

but i saw other people solve this problem in different way of code. and i got curious this point. what does open(0) doing in other people's code? their code works just as mine. here is other people's code:

*p,q,r=map(int,open(0))
print(min(p)+min(q,r)-50)

if anyone can help me with this stuff will make my day :) thank you for reading ! have a nice day!

KokheeJ
  • 41
  • 4

0 Answers0