def lettergrade(score)if score > letter 'aelsegrade must be bcd or if score > letter 'belsegrade must be cd or if score > letter 'celsegrade must or if score > letter 'delseletter 'freturn letter this repeatedly increasing indentation with an if statement as the else block can be annoying and distracting preferred alternative in this situationthat avoids all this indentationis to combine each else and if block into an elif blockdef lettergrade(score)if score > letter 'aelif score > letter 'belif score > letter 'celif score > letter 'delseletter 'freturn letter the most elaborate syntax for an if-elif-else statement is indicated in general belowif condition indentedstatementblockfortruecondition elif condition indentedstatementblockforfirsttruecondition elif condition indentedstatementblockforfirsttruecondition elif condition indentedstatementblockforfirsttruecondition elseindentedstatementblockforeachconditionfalse the ifeach elifand the final else lines are all aligned there can be any number of elif lineseach followed by an indented block (three happen to be illustrated above with this construction exactly one of the indented blocks is executed it is the one corresponding to the first true conditionorif all conditions are falseit is the block after the final else line be careful of the strange python contraction it is elifnot elseif program testing the lettergrade function is in example program grade py see grade exercise (page final alternative for if statementsif-elifwith no else this would mean changing the syntax for ifelif-else above so the final elseand the block after it would be omitted it is similar to the basic if statement more on flow of control