5
I wanted to know how I use the format ":.0f"
without rounding up the number.
I want to catch a input
of seconds and turn it into minutes, here’s my code:
segundos = int(input())
minutos = segundos
while minutos > 60:
temp = minutos / 60
minutos = temp
print(f"Minutos: {minutos:.0f}")
I want it to print out the exact number of minutes without rounding up so I can take the rest and put in seconds.
But when I walk in with the input
650 for example, instead of giving me the value 10 (minutes), it gives me 11.
I know if I put .format(int(minutos))
he will return me the 10, but would have some way to specify with some argument in this ":.0f"
that I don’t want it to end? How do I not do it?
print(f"Minutos: {minutos:.02f}")
or without any formatting instruction withprint(f"Minutos: {minutos}")
– jsbueno
Just do not forget that the amount after the point is not in "seconds" - 1.5 minutes == 1m:30s
– jsbueno