Come Ramble With Me!

Will you ramble with me?


  • Total voters
    311
Hallo humans! Does there happen to be any coding experts on here (or not so experts...)
This is what I have so far. I'm doing CodeHS. What I need to do is change it so that there are only 2 functions. (currently, I have four) Any helpers? Thanks!

#Change 0C to F:
def farenheit_to_celcius():
print(1.8 * 0 + 32)
return farenheit_to_celcius
farenheit_to_celcius()


# Change 100C to F:
def farenheit_to_celcius():
print(1.8 * 100 + 32)
return farenheit_to_celcius
farenheit_to_celcius()
# Change 40F to C:
def celcius_to_farenheit():
print((40 - 32) /1.8)
return celcius_to_farenheit
celcius_to_farenheit()

# Change 80F to C:

def celcius_to_farenheit():
print((80 - 32)/1.8)
return celcius_to_farenheit
celcius_to_farenheit()
(also the formatting didn't stay correct when I pasted my code, so a lot of it should be indented)
 
This is a screenshot of it
coding.png
 
Sorry Lemon. It’s been awhile since I’ve done any coding.
I’ll take a look at it and see if I can dig back and remember though.
I figured it out!
def farenheit_to_celsius(celsius):
print(1.8 * celsius + 32)
return farenheit_to_celsius

def celsius_to_farenheit(farenheit):
print((farenheit - 32) /1.8)
return celsius_to_farenheit

#convert 0C to F

farenheit_to_celsius(0)

# Change 100C to F:

farenheit_to_celsius(100)

# Change 40F to C:

celsius_to_farenheit(40)

# Change 80F to C:

celsius_to_farenheit(80)
 
I figured it out!
def farenheit_to_celsius(celsius):
print(1.8 * celsius + 32)
return farenheit_to_celsius

def celsius_to_farenheit(farenheit):
print((farenheit - 32) /1.8)
return celsius_to_farenheit

#convert 0C to F

farenheit_to_celsius(0)

# Change 100C to F:

farenheit_to_celsius(100)

# Change 40F to C:

celsius_to_farenheit(40)

# Change 80F to C:

celsius_to_farenheit(80)
Glad you did! Because I totally forgot to look! 😃


:oops:
 

New posts New threads Active threads

Back
Top Bottom