18/19 Review: Modules


#1



I would like to know why when I tab the print line, it became an error. Thanks!


1.
from math import sqrt       < Correct
print sqrt(13689)
2.
from math import sqrt       < Error
    print sqrt(13689)


#2

Because of indentation rules. You cannot indent when indent is not needed, python is very exact about when to indent and when not to indent. :slight_smile:

Hope this helps!


#3

Thanks!!
However, I still can't figure out why return needs tab but print doesn't. :frowning:


#4

It's not about return or print its about when to indent and when not to. Automatically when you need to indent python will do it for you. :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.