I tried defining a function below (part of a longer code block), but came across an 'indentation error' identified at the 4th line. Could somebody please tell me what the error is?
guess = int(raw_input('Your first guess? '))
def next_guess(n):
n -= 1
print "You now have %s attempts left" %n
guess = int(raw_input('Your next guess? '))
Your indentation is a mix of tabs and spaces. The tab character might look like it's four spaces wide in your text editor/IDE, but Python can interpret it as anywhere between one and eight spaces. This can cause Python to become very confused. Replace the tab on your n -= 1
line with spaces.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.