-5
minutes = 9 * 52
    
hours = round(minutes // 60,1 )
    
print(hours)

This is my code, but it only prints out 7 when in reality it should be 7.8 hours instead of 7

I'm new to Python, so please don't hate too much :P

RiveN
  • 2,595
  • 11
  • 13
  • 26
Proxie
  • 37
  • 2

1 Answers1

1

Change your integer division // to floating point division / before you round.

>>> minutes = 9*52
>>> hours = round(minutes/60, 1)
>>> hours
7.8

This is what is going on within your round function call

>>> 468 // 60
7
>>> 468 / 60
7.8
Cory Kramer
  • 114,268
  • 16
  • 167
  • 218