LearnFrenzy
Sign in Take a free test

Python Built-in Functions · Predict the Output · Question 1

abs, round and pow Answer, explanation & discussion

  • Output
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

What is the output of the following Python program?

main.py
print(abs(-7.5), round(2.675, 2), round(1234.5678, -2), pow(2, 10, 7))
  • A 7.5 2.67 1200.0 2 Correct
  • B 7.5 2.68 1200 2
  • C -7.5 2.67 1234.57 2
  • D 7.5 2.68 1200.0 1024
Correct Answer: Option A

2.675 is stored as 2.67499…, so it rounds down. -2 digits rounds to hundreds. 1024 % 7 = 2.

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