-1

I typed in the following code

def root():
    x = int(raw_input("Enter a number:\n"))
    y = int(raw_input("Enter the power which you want:\n"))
    return x^y
print "Hey, we are learning python!"
print "Let's learn about functions!"
print "The result is:", root()

I get the following error:

y = int(raw_input("Enter the power you want\n:"))
^
Indentation Error: unexpected indent
Mazdak
  • 105,000
  • 18
  • 159
  • 188

1 Answers1

0

You should use the same indentation throughout your code. If you start with 4 spaces, use 4 spaces everywhere. If you start with tabs, continue with tabs etc.

For that reason, also be careful when copying code for a file with different indentations.

Some text editors (i.e. Sublime) or IDEs can convert your whole file to the same indentation to avoid such errors.

Cantfindname
  • 2,008
  • 1
  • 17
  • 30