Module 5.3 - Screeching halt

5-3
module-5

#1

Hey! I am finished with the course, with the exception of one quiz in unit 5.3 - the one where we’re asked to write some code to calculate the diameter of a circle using its user-provided diameter. I have spent three days trying to power through the problem with zero success. I have written dozens of versions of my code, most of which work in the code editor (and on repl.it) as expected. I have googled similar problems in python extensively and I have just not been able to figure out exactly what the quiz is expecting to hear. My issue is with the last line of the quiz, the print command wording - the other four fields are pretty cut-and-dried so I won’t spoil the surprise on those. Here is my latest code for the print command line:
print("The diameter of the circle is ", calculate_diameter(circumference), “.”)
I have also tried the following (all of which run correctly, and many other variations):
print(calculate_diameter(circumference))
print(“The diameter is:”, calculate_diameter(circumference))

Anyone have any suggestions for me?
Thanks in advance!
Chris


#2

Sometimes an error message seems to indicate a problem with, say, a print line-- but the issue is elsewhere (ie maybe the way the function is defined). If the function sends an unacceptable value to the print line, that might generate an error message-- Just my 2 cents. You might try looking back at the function you defined and called and make sure it is tight.


#3

Thank you! I will revisit that.


#4

No dice, unfortunately. I have come to the conclusion that it’s time to move on, as this seems to be not a priority in the long run, it’s just a tutorial. I appreciated the rest of it very much and am moving on to other classes in Python + other languages. Thanks for the help!


#5

Hi @Masmics, sorry for the late reply. It looks like you aren’t using the user_input variable defined in the line above when calling your function. That variable will hold the number that was provided as the circumference, so that is the number you want to send to your function. If you simply send circumference to calculate_diameter, the value that the user entered will be lost.

Also, this function only needs to print the diameter - two of your lines above appear to provide extra text ("The diameter of the circle is " and “The diameter is:”). While this would normally be helpful to someone reading the results of your program, that extra text will confuse the quiz in Stepik.


#6

Thanks Adam! I finally got it worked out. I wasn’t getting that user_input could be passed in in place of circumference in the function definition (because user_input is also a variable and because circumference is part of a standard equation, that wasn’t intuitive to me at all, I would have just labeled the user input variable accordingly). I wasn’t going to revisit it because it ended up not being a great use of my time at that moment, but I’m glad I did. Thank you very much!


#7

I still don’t get it because those are drop down menus and you cannot put the user_input in place of the circumference. I am so confused.

I would have just typed:
circumference=float(input(“What is the circumference?”)
HELP!