Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 18 Online
OpenStudy (anonymous):

I have a syntax error http://pastebin.com/KVVwk6sa

OpenStudy (anonymous):

Try removing the ' '. The syntax is for char in x: if char == symbol. By the way, the assignment is also without quotes, and you don't need to create another variable for that. for char in string: if char == symbol: count += 1

OpenStudy (anonymous):

This would be more simple though: http://pastebin.com/KtJifWD9

OpenStudy (anonymous):

x and 'x' are vastly different things. x is a variable that can point to anything. 'x' is a string with a single lowercase X in it. Same for symbol and 'symbol'. One is a variable, the other is a string with 6 characters in it.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!