I assume the trainer should have clarified the whole tutorial better. It doesn’t work because does brown sugar contain gluten of the “of” typo within the conditional. I suppose incorporating the ‘print’ operate would be useful req.
Thank you,I’ve solved this problem too. But then what ought to I do once I wish to change one other line to write down new codes similar to return or elif. I was wondering why this code was incorrect. The console says that there’s invalid syntax in line three and the “supportive” field is telling me to examine my colons. I checked it and it nonetheless provides me the same response. Rather than cutting/pasting, strive typing the code out with precisely the same formatting as shown.
It’s a helpful ability to have. You want a colon at the finish of the else assertion. You try and examine answer to a function no() somewhat than a string ‘no’. Your second conditional assertion should be an elsif not an else statement. Your first if assertion tries to compare reply to a variable yes not a string ‘sure’.
Or if you’re utilizing the old editor, it goes to be on the high. @Lodog Next time please submit your questions in the Q&A part. @Davide Linosa Next time please publish your questions in the Q&A section.
An exception was raised while operating your code, see the console window for the error message. The other place I can see as a difficulty is on your else line. The return assertion should be on a different line, indented. I’ve been programming on and off for a very long time and have used Python before, so most of this has been review for me.
I am haveing troubles with the massive if reveiw. I am getting 2 error messages. The first one tells me that the_flying_circus mustn’t take any arguments. The next tells me that the_flying_circus should not take precisely one argument. There was an error whereas working your code.
For that reason, it’s best to use four areas (not the tab key!) when indenting. This discussion board reply ought to allow you to if you think indentation is the problem. Trying reading the error messages returned from the interpreter and start trying to know them.
A lot of these answers listed beneath are helpful but I would possibly assist someone however putting my resolution as nicely. If you make all these modifications, you should see fixes. Try and discover ways to repair your personal syntax errors any longer although.
I’ve in all probability put about 3-4 hours in today. When I did this exercise myself, I bumped into issues I couldn’t explain either. Ultimately it turned out that a few of the indentation was areas and a few was tabs. Python insists on consistency. @cna892 Next time please publish your questions within the Q&A part. This can be found within the editor at the footer of the web page .
For this train, you want to make positive that the operate returns the boolean value True, somewhat than only have it print a message. In truth, it’s not essential for the perform to print anything; the important task is to have it return True. Python doesn’t like blended areas and tabs whenever you indent a line.