8ball project coding syntax error

Keep getting a syntax error using this code:

if random_number == 1:

answer = “Yes - definitely.”

elif random_number == 2:

answer = "It is decidely so.

I have looked at the solution and even copied the code directly from it and still get an error.

Hey, @amr301 welcome to the forums.

Do you see anything wrong with the elif part of your code?

And also don’t forget to format your code: [How to] Format code in posts

No i do not see any issue with the code hence the forum post…I get a syntax error when COPYING the code from the solution so i do not understand what the error is at all.

Where are you getting a solution from? CC does not provide a solution to copy in the project itself. And do you see anything wrong with your indentation or when you declare the answer varible?

Maybe you have forgotten to indent correctly or forget some quotation marks necessary to make it work. It’s hard to tell without seeing it in the context of the exercise. If the trouble isn’t solved, just move on and return later with a fresh mind for it.

Check your quotation marks in your variable definitions.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.