Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
how do I round a number to two decimal places in python 3 without using .2f?
+3
votes
asked
Jun 19, 2022
by
Matthew Kim
(
150
points)
The instructors says we can round it, but how do I do that without using .2f? (I'm not supposed to use .2f yet)
python-3
want-help
Please
log in
or register to answer this question.
2 Answers
0
votes
answered
Jun 20, 2022
by
Peter Minarik
(
101,420
points)
This
article should help. Use the
round()
function.
x = round(5.76543, 2) print(x)
commented
Jun 27, 2022
by
Matthew Kim
(
150
points)
thanks so much!
Please
log in
or register to add a comment.
0
votes
answered
Jun 22, 2022
by
Tegah D Oweh
(
140
points)
x = 5.85629
print(x)
x = x * 100
x = round(x, 0)
x = x / 100
print(x)
commented
Jun 27, 2022
by
Matthew Kim
(
150
points)
thanks a lot!
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...