LearnFrenzy
Sign in Take a free test

Python Built-in Functions · Find the Error · Question 6

Bug: ₹99.99 becomes ₹99 Answer, explanation & discussion

  • Find the error
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

The price should be rounded to the nearest rupee (100). Which statement correctly identifies the bug?

main.py
price = 99.99
print("Rs", int(price))
  • A int() rounds down only for prices
  • B int() truncates toward zero; use round(price) to round to the nearest whole number Correct
  • C price must be a string
  • D print removes decimals
Correct Answer: Option B

int() simply drops the fractional part.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links