K
Kamel Avad
Guest
Im trying to write a program that has a data of n = 10 which is the moments of time of one day, these are: hours (values from 0 to 23), minutes (from 0 to 59) and seconds (from 0 to 59). Write a program that compares any two moments of time (determines which of the moments occurred in given day earlier). So in simpler words I want to have 10 random moments with hours minutes and seconds, hours can't be repeating so for example lets say [14:34;24, 16:25:26...... and so on for 10 times, so if I want to take lets say the first number from the list and the 2nd from the list so that would be (14:34;24) and (16:25:26) and to see which one happened earlier between the 2. was able to state the numbers but not sure how to do the comparision and how to state it all.
Answer for: "The data of n=10 moments of time of one day are given buy hours minutes and seconds how to make it compare compares any two moments of time"...
Mã:
import random
hours = (random.randint(0,23) for i in range (10))
minutes = (random.randint(0,59) for i in range (10))
seconds = (random.randint(0,59) for i in range (10))
num_of_H=list(zip(hours,minutes))
num_of_M=list(zip(hours,minutes))
print(dict(num_of_H))
nums=(i for i in range(10))
res=dict(zip(nums,num_of_H))
print(res)
while True:
Answer for: "The data of n=10 moments of time of one day are given buy hours minutes and seconds how to make it compare compares any two moments of time"...