I am getting a syntax error on line 42(4th last line) and I cant fix it can someone please help?
def main():
# This code reads in data.txt and loads it into an array
# Array will be used to add friends, remove and list
# when we quit, we'll overwrite original friends.txt with
# contents
print"Welcome to the program"
print "Enter the correct number"
print "Hockey fan 1, basketball fan 2, cricket fan 3,Numbers of favorite players-4"
choice = input("Select an option")
while choice!=3:
if choice==1:
addString = raw_input("Who is your favorite player??")
print "I love Kessel"
elif choice==2:
remInt = raw_input("Do you think that the Cavaliers will continue ther loosing ways?")
print "I think they can beat the Clippers"
e开发者_JAVA技巧lse:
inFile = open('data.txt','r')
listNumbers = []
for numbers in inFile:
listNumbers.append(numbers)
print numbers
inFile.close()
print "Cricket is a great sport"
def quit():
Print "Quitting Goodbye!"
if __name__ == '__main__':
main()
If that's really your code, your print
is upper-cased.
print "Quitting Goodbye!"
Also, I just ran your code, and you have some improper indentation in your else
clause:
inFile = open('data.txt','r')
listNumbers = []
for numbers in inFile:
listNumbers.append(numbers)
print numbers
inFile.close()
try lowercase "print"? {make answer at least 30 characters, please ignore}
Look that you have written the print statement capitalized. It must be print
not Print
.
精彩评论