After you get a few lectures in it is very confusing and the questions for you to go to the next step isnt really explained. Python on this platform needs a definate revamp for sure. I will just use my book or a youtube channel to learn python. This site is geared towards literally web design. Dont offer certain languages if the video and explanations and the question does not even match the code you ask about…
exact same code as they want you to try and error
As the error states, the string
"5 degrees" cannot be converted to a floating point number. You need to use an actual number, such as
Since this conversion is impossible, I think that you misunderstood the instructions. The instructions didn’t ask you to convert a string into a floating point number.
@cowboyup993 Yes. I recommend using a regular text editor not Pycharm. I tried it once and thought an unnecessarly large program for coding in Python.
The Traceback error message usually points you directly to what the issue is. You will get used to figuring out what they mean after time.
it is foolish to convert a string which contains alphabets into float and blame an IDE.
you should get the first character of the string which is 5 and then convert.
float(temp) # I guess this does not work even in a normal text editor. float(temp) # I hope this works.
I think , that is the exercise do you mean!
Given the following code
temp = “5 degrees”
cel = 0
fahr = float(temp)
cel = (fahr - 32.0) * 5.0 / 9.0
Which line/lines should be surrounded by try block?
They want you simply to understand the use of (try…except) in case of a typo!
for example if they ask you to enter a temperature as follows:
temp = float(input("Enter a temperature))
and you enter 5 °F.
I do not need to explain you what will happen without using ‘try … except’!