LearnFrenzy
Sign in Take a free test

Modules and Packages · Predict the Output · Question 3

A module imported under an alias Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 3 Back to Exercise

What is the output of the following Python program?

main.py
import math as m
print(m.__name__, hasattr(m, "tau"), round(m.tau, 2), type(m).__name__)
  • A m True 6.28 module
  • B math False 6.28 module
  • C math True 6.28 module Correct
  • D math True 6.28 math
Correct Answer: Option C

The alias is just another name for the same module object, whose __name__ is still "math". tau is 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