Daily Challenge #57

Welcome to todays #daily-challenge.
Task for today:
Five programmers work together in the same office. They need to have a conference where all the employees will attend it. Since they are not very smart programmers, like you, they need help. Write a program which takes 5 inputs. First is a list of four items: hours when the first programmer comes to work, minutes when the first programmer comes to work, and leaves (seperate hours and minutes). Same for the other four. Return no if the conference time is 0.
Sample input and output:

Have fun!

5 Likes
Solution

or Python (variables in Serbian)

dolazak = []
odlazak = []

for i in range(5):
    [x,y,a,b] = map(int, input().split())
    dolazak.append(x*60+y)
    odlazak.append(a*60+b)

od = max(dolazak)
do = min(odlazak)
ukVreme = do-od

ukSati = ukVreme // 60
ukMin = ukVreme % 60

if ukSati <= 0 and ukMin <= 0:print("no")
elif ukSati <= 0 or ukMin < 0:print("no")
else:print(ukSati,ukMin)
2 Likes

I always tried to wait a day before i gave the solution :wink:

1 Like

It’s just there if anyone really doesn’t feel like doing it but wants to learn something new.
Thanks for the tip btw, will keep it in mind! :smiley:

3 Likes