Please Help: 5.3 #11


#1

I’m lost. I may have fried my brain and am missing something simple. Please assist


#2

The answer that you submitted at 7:26 AM (on the right) did fix the three bugs from the answer that you submitted at 7:10 AM (on the left)—1) the first line is not defining the function [what it is doing is call a function that hasn’t been defined yet]; 2) returning a call to the function that you are defining which is an instance of a very handy tool in programming called ‘recursion’ [but in this instance (assuming that you had used ‘def calculate_diameter(circumference):’ instead of ‘calculate_diameter(circumference):’) you would never exit this function once it was called: it would call on itself forever and ever and ever and ever until… maybe… the computer environment that the program would be running in “took,” let’s say, “a hammer to it”; 3) printing an undefined variable [nuff said].
The only mistake with the answer you submitted at 7:26 AM was* (I anticipate that you figured it out sometime later today, after letting the frustration simmer down) an exasperating one: you have a ‘(’ right after ‘print(’ which leaves the argument print function unclosed, since ‘(’ wraps around the last parenthesis ‘)’.
Making it read like this: ‘print(’
and not like this: ‘print()’


#3

BTW, at first I thought the machine that was testing your submission was rejecting your answer because you were converting the user input into an int instead of a float, but apparently the machine accepts both types of submissions. If you stop to think about it though, a float would work world’s better than an int for representing the circumference of a circle. Most things, when we measure them, don’t make nice whole numbers.


#4

try print(calcluate_diameter(user_input))

Remove the parentheses that you gave as (calculate_diameter(user_input) instead just say
calcluate_diameter(user_input) as answer


#5

calculate_diameter(user_input) as answer --was typo earlier


#6

I’m stuck on this same fill in the blank exercise (5.3 #11) and while both of the users’ helpful inputs make perfect sense to me, none of them actually solve the problem. I’m wondering if there’s an internal bug in the exercises’ code.


#7

Good afternoon Leigh,

I got my answer to work a few days ago. I see the other screens above…

For part 4, does int fit the users’ input 100% of the time or is there a better fit?

For part 5, we are calling the function here. We defined the function above. Now that we have the users’ input, how do we want to pass it through this function. Also, remember the answer is already in parentheses.

I hope this helps. Please keep us updated. Feel free to see a similar answer reply in my “Memphis” thread from Sunday.

Good luck! You got this!


#8

Thanks, i just had an extra space in one of the blanks. got it now.