James D. answered 12/21/22
Software Engineer specialized in Python, Golang, and C.
Hello Isaac,
This seems to be a flagrant violation of the academic honesty policy (https://support.wyzant.com/hc/en-us/articles/115002086926), specifically Paragraph 2 -- "Tutors agree through the Wyzant platform, not to help students complete work or tests" as well as in violation of the policy on the Wyzant Ask An Expert board: "please refrain from asking the exact question from an assignment".
However, I am happy to give you some general guidance for how to think about answering your question:
When the assignment specifies that we'll "Apply the function syr repeatedly until you reach 1", this indicates to us that the function will be recursive, i.e. call itself within itself, and that syr(1) will be the base case.
To implement a recursive function in python, use the following syntax (The example I've provided is a recursive fibonacci calculator):
I've called fib(n-1) and fib(n-2) from within the fib() function. You'll do the same with your syracuse function, but since it returns a string I'd recommend returning just a string for the base case, and for the recursive cases returning a call to syr() as well as the syracuse number for the specific input at that recursive level.
If you have questions about how to perform the n/2 if n is even, 3n + 1 if n is odd logic I'm happy to answer in the comments, but I'm assuming right now that the recursion is the piece that's confusing you since you've given no context other than the full question.
Best,
James