Random task! You need to calculate the number of hours in 888 minutes. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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.

6th Jun 2021, 9:19 PM
Sanchit Bahl
Sanchit Bahl - avatar
2 Respostas
+ 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
6th Jun 2021, 9:22 PM
ChaoticDawg
ChaoticDawg - avatar
- 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!
6th Jun 2021, 9:27 PM
Sanchit Bahl
Sanchit Bahl - avatar