logo CodeStepByStep logo

contribution

Language/Type: Python if/else input redundancy

Rewrite the code below by factoring to eliminate redundancy. Your code must produce the same results. To simplify things, you may assume that the user always types 1 or 2 for the multiplier.

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.