Section 5.3 step 11 and step 16


#1

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.

I have googled youtubed … and the cryptic answers in this help area aren’t helping.

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)


#2
  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? .

#3

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?


#4

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.


#5

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.


#6

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?))


#7

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.


#8

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


#9

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


#10

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


#11

Yes, i am have trouble with the print statement


#12

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


#13

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


#14

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.


#15

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.


#16

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)


#17

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.


#18

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)


#19

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


#20

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