Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
Random task! You need to calculate the number of hours in 888 minutes.
Could any please help me with this question? How do I solve that with floor division and modulo operator.
2 ответов
+ 3
Divide the number by the number of minutes in a hour (60) to get the number of hours. Modulo the number by the number of minutes in an hour (60) to get the remaining minutes.
example;
num = 135
hour = num // 60 # 2
mins = num % 60 # 15
- 2
Thank you very much for your prompt answer. I was also dividing the n with 60, but for divide we use only one /, right? But here you used this // i.e. floor division. Which basically means the quotient, that we will get after dividing i.e. after applying /. I am perplexed 😅 But still I really appreciate your help man, thanks!