# Section 5.3 step 11 and step 16

im lost and ive look at all the other post and I still don’t get it. I cant figure out what I’m missing or not inputting the why the system wants it and I have been working on these two problems for over 2 hrs now.

def calculate_diameter(circumference):
pi = 3.14
diameter = circumference / pi
return diameter
user_input = int(input(“What is the circumference of the circle?”))
print(calculate_diameter)

1 Like
1. The problem is on the print line. It is missing a parameter(some input). Ask, what does the function need to complete it’s calculations? What is the variable that you should feed it each time you call it? To calculate the diameter you need pi and circumference. You’re giving the function pi in the definition already. So how (or where) do you pass it the circumference? .

This is exactly where I am confused. I have put circumference/pi here and it doesn’t work. I have put calculate_diameter(circumference/pi), are either of those on track? Do I need to plug in actual numbers here?

I had the same problem. I then realized I had to think where my function was getting its variables/information to run. What is the circumference and how do I get into my function to be able to print it.

I went back to the editor and plugged in print("The diameter of the circle is " + str(user_input/3.14) and this gave me the correct answer. I plug this into the blank and it is wrong.

Ok I hope this is clearer. I’m not sure if they covered this yet but this is the basic logic:

if you want to define a function:
def function_name(parameter):
conditionals
return output

If you want to call and print the function:
variable = parameter
print(function_name(variable))

In this question, the first 3 blanks are defining the function and the last two blanks call and print the function.

You need to pass the parameter into the function call on the print line. However the parameter now has the name of the variable.

print(calculate_diameter(what variable goes here?))

1 Like

Your circumference is being supplied by the user input. Whatever variable you use to get the circumference from the user will now be the parameter you pass the function.

1 Like

Thank you so much for that explanation! That finally made it click! Hip hooray!!!

1 Like

I am still having difficulty with solving the problem. Is there any other way to explain it?

Which part are you having trouble with? The logic? The print statement?

Yes, i am have trouble with the print statement

What output do you get when you run it? Is there an error message of any kind?

I am having the same problem with the print I do not understand. I have been working on this for 2 days

I had trouble as well with the fill in the blank. Think about what the user_input is and look at your def function. Your variable description might be off for your entry. Print what the function would be with the input from the user. I hope this doesn’t give to much away. Good luck. The last question is just a basic def function with no need for user input.

1 Like

I don’t know if this may help anyone. It was not clicking in my head that user_input is not just a input put is also a variable. Once I figured it out, I found the variable I needed to solve my problem.

1 Like

I am struggling to solve this as well. Please help. I am pretty sure some how I am missing it on the return and print lines. I have read what you all wrote and responded to but I am still clueless.

def calculate_diameter(circumference):
pi=3.14
diameter = circumference / pi
return diameter

user_input = int(input(“What is the circumference of the circle?”))
print(calculate_diameter)

It’s pretty close, but for the function to work, you have to pass it a value. Ie when you “call” it, you have to supply a circumference variable.

I have read all of the message boards regarding this problem and went on google and I do not get what to put for print

def calculate_diameter(circumference):
pi=3.14
diameter = circumference / pi
return diameter

user_input = int(input(“What is the circumference of the circle?”))
print ( "The diameter of the circle is " + str(diameter)

Remember, if you open a parenthesis, you must close it, too.

I added a parenthesis and it is still wrong so I am not sure what else to do