logo CodeStepByStep logo

print_factors

Language/Type: Python fencepost %

Write a function named print_factors that accepts an integer as its parameter and uses a fencepost loop to print the factors of that number, separated by the word " and ". For example, the number 24's factors should print as:

1 and 2 and 3 and 4 and 6 and 8 and 12 and 24

You may assume that the number parameter's value is greater than 0.

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.