Indentation for "return" function


Hey, so i was working on the “Conditionals and Control Flow” chapter of the python program and ran into a question at the final chapter(15) where you make an if/else/elif statement for calculating grades. Under the (if and elif) lines of code, the return function had one indentation. However, after the last component, (the else line of code), I am getting an indentation error. It only works when i don’t indent the (return function). Is there a reason why this is only happening for the last line or does it have something to do with the fact that it is an “else”? Thanks, i uploaded a picture of it above for reference


We cannot tell from the picture if there are mixed spaces and tabs. Suggest remove all indents and replace with four spaces per block level.


so the (return “F”) on line 12 will only work if it is directly underneath the else (as shown below), is this a rule of ending a code block? thank you for the help by the way!


There should not be a condition after the else: Didn’t mention that earlier since I hoped you would discover it while fixing indentation.


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