0
Help me!
a=3.1874828 How to print to the screen 3.18
4 Respuestas
+ 5
a = 3.1874828
print('{0:.2f}'.format(a))
+ 1
a=3.1874828
# If print(3.18) is not an option
# you can use string slicing
print(str(a)[:4])
+ 1
ms arnold round gives 3.19 not 3.18 as required
+ 1
# no problem ms arnold, it's worth experimenting
# with code there is usually multiple solutions.
a=3.1874828
print(int(a*100)/100)
# or
a = 3.1874828
print(((a/.01)//1)/100)