我在第28行遇到了无效的语法错误,其中我为我的循环声明了x。我对此有点新意,所以如果你能解释我为什么会得到这个错误我会非常感激
def peace():
# ord() function feeds back a int value for the ASCII codes and chr() takes these int's and turns them back in to char's
ripped_function = [] # this is going to hold a string broken down letter by letter
type_function = [] # this is going to hold the types of char held in the ripped_function list
ripped_function[:0] = raw_input("This is letter by letter") # takeing in user entered string
print(ripped_function[0:len(ripped_function)]) # to see the string broken down
i = 0
for i in range(0,len(ripped_function) # for the entire list
x = ( ord(ripped_function[i]) ) # x is supposed to be the int value that ord() returns
if (x >= 97) and (x <= 122) # 97 is lower case 'a' and 122 is lower case 'z'
type_function[i] = ['lower case letter'] #classifying
if (x >= 65) and (x <= 91) #65 is capital 'A' and 91 is capital 'Z'
type_function[i] = ['upper case letter'] #classifying
else:
type_function[i] = ['THIS NEEDS MORE PROGRAMMING 2343'] #just to let me know where to keep building lose ends with a search code 2343
print(type_function[0:len(type_function)]) #to see the break down
return("just keep going") #because i need a rememinder sometimes