logo CodeStepByStep logo

factoring_awesome

Language/Type: Python if/else redundancy

The following code is poorly structured. It contains redundant statements that unnecessarily occur multiple times. Factor out redundant code from the following example by moving it out of the if/else statement, while preserving the same behavior and output.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.