+ 12
Is this code correct for conversion of Celsius to fahrenheit.not working..plz help
celsius = int(input()) def conv(): Celsius = (Fahrenheit - 32) * 5.0/9.0 celsius = conv(fahrenheit) print()
30 Respuestas
+ 9
Arvind Kumar So it is Celsius to Farenheit???
Sorry bro, my bad not reading properly.
celsius = float(input())
def conv(cels):
fahren = (cels * 9/5) + 32
return fahren
fahrenheit = conv(celsius)
print(fahrenheit)
+ 5
《 Nicko12 》 nice code
by the Arvind Kumar it was a nice question
+ 4
EDIT: (lol I focused on the code, not on the formula)
celsius = float(input())
def conv(cels):
fahren = (cels * 9/5) + 32
return fahren
fahrenheit = conv(celsius)
print(fahrenheit)
- - - - - - - - - - - - - - - - - - - - - -
#First, the input is to convert Celsius to Fahrenheit, so the formula must be Celsius to Fahrenheit.
#Second, you should have a Paramater(cels) in the function if you want to pass an Argument(celsius) if you want to modify a certain argument.
#Third, you must have a "return" keyword to return the converted value if you are assigning it to a variable.
#Last, you must print the variable "fahrenheit" which has the returned or converted value to print or output the result.
I hope this helps, Good Luck and Happy Coding!
+ 4
Arvind Kumar
Try this:
fahrenheit = float(input())
#I forgot that it needs decimals.
+ 4
《 Nicko12 》 Thanks for the help brother
+ 3
《 Nicko12 》 sorry bro your code is not working
+ 3
《 Nicko12 》 actually it is a project question in Python and I am not able to solve it , it is not running
+ 3
My code is running: 🥳🥳🥳
celsius = int(input)
def conv(c):
fahrenheit = (c * (9/5) + 32)
return fahrenheit
fahrenheit = conv(celsius)
print (fahrenheit)
+ 2
fahrenheit = float(input())
def conv(fahren):
cels = (fahren - 32) * 5.0/9.0
return cels
celsius = conv(fahrenheit)
print(celsius)
#This is also not working
+ 2
1st case
input =36
Output=96.8
2nd case
input=0
Output=32.0
+ 2
Actually, the formula is provided on the question page. You just have to copy and paste into the function.
https://code.sololearn.com/cmb1VX4r61pq/?ref=app
+ 2
celsius = int(input())
def conv(c):
#your code goes here
a=((9/5) *c + 32)
return a
fahrenheit = conv(celsius)
print(fahrenheit)
+ 2
Sneha Singh thank u
+ 2
Gene Awuni
If u wanna know the « Celsius / Fahrenheit » code coach solution... see 6 msg. above urs !!
+ 2
harsh lakhara see 4 msg above u !!
+ 1
Arvind Kumar Its working just fine with me, Is that a challenge that needs test cases?
+ 1
Sorry, I cant see the test cases so what are the Input and Output of the first two test case, knowing this would be a big help.
+ 1
Okay, So, what are the test cases?
+ 1
The problem is in your def function
You should put:
fahrenheit =
Instead of Celsius because your are requested to get celsius degree and need convert it to fahrenheit >>>> the variable
So your solution should be:
celsius = int(input())
def conv():
fahrenheit = (celsius * 9 / 5) + 32
return fahrenheit
fahrenheit = conv(celsius)
print(fahrenheit)
+ 1
def fahren(cel):
return (9/5)*cel + 32
c=fahren(eval(input()))
print(c)