#Create a function that takes in a temperature in Fahrenheit and returns the same temp in Celcius

13 messages · Page 1 of 1 (latest)

night widget
#

this is what I have so far

#

<@&727457638702514237> sorry for pinging

snow cloud
#

you cant access variable celsius because there isnt any

#

in fahrenToCelc you created Celsius variable (case sensitive) but even then it wont work because Celsius is in local scope: it only exists inside the function, once function stops execution, its destroyed and the value cant be restored

#

what i would do is:

  1. make fahrenToCelc take an argument that is a value of temperature in fahrenheit and return the same amount in celsius with return keyword
  2. remove from math import *, you arent using any math's functions
  3. remove float(...) from the formula (line 5), you already converted fahrenheit value into float
  4. get rid of main function, the code is light enough to not use it. plus you're executing code globally so there is no point
night widget
#

so what would I do?

#

this is what I am left with

snow cloud
#

are you required to use a function?

night widget
#

yeah

snow cloud
#

then if i were you, i'd replace line 4 with line 11