Else doesn’t have any condition after. So remove True and False. Can you please assist me in why this code doesn’t work? This is the toughest task but.
I’ve in all probability put about 3-4 hours in at present. When I did this train myself, I bumped into issues I couldn’t explain either. Ultimately it turned out that some of the indentation was areas buffalo wild wings naked and a few was tabs. Python insists on consistency. @cna892 Next time please publish your questions in the Q&A section. This can be discovered within the editor on the footer of the page .
For this train, you have to ensure that the operate returns the boolean value True, rather than only have it print a message. In reality, it’s not necessary for the function to print something; the important task is to have it return True. Python doesn’t like blended areas and tabs if you indent a line.
Instead of providing large chunks of code, provide little snippets with the interpreter error and ask for assist deciphering the error. People will try and allow you to understand what you’re studying extra. All your return statements must have to be decreased a level of indentation. You can format code in the editor window.
Thank you,I’ve solved this drawback too. But then what ought to I do after I wish to change one other line to write down new codes corresponding to return or elif. I was questioning why this code was incorrect. The console says that there is invalid syntax in line three and the “supportive” box is telling me to verify my colons. I checked it and it still offers me the identical response. Rather than cutting/pasting, try typing the code out with exactly the same formatting as proven.
I think the instructor should have clarified the whole tutorial better. It doesn’t work due to the “of” typo in the conditional. I assume incorporating the ‘print’ perform could be useful req.
It’s a useful talent to have. You need a colon on the finish of the else assertion. You try and compare reply to a operate no() quite than a string ‘no’. Your second conditional assertion must be an elsif not an else statement. Your first if statement tries to compare answer to a variable sure not a string ‘sure’.