USING CLASS IN PYTHON | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

USING CLASS IN PYTHON

how to convert from Fahrenheit using user input=("user input should be in Fahrenheit") to Celsius using class in python???

26th Apr 2018, 1:54 AM
KHALIFA EL HARA
KHALIFA EL HARA - avatar
6 Answers
+ 2
#Please input in Farenheit c = int(input()) Result = 9/5*c print(Result)
26th Apr 2018, 2:46 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 2
i got that. i have to use Class
26th Apr 2018, 3:01 AM
KHALIFA EL HARA
KHALIFA EL HARA - avatar
+ 2
I did like you said but the problem the function doesn't get the value from the input
27th Apr 2018, 12:55 AM
KHALIFA EL HARA
KHALIFA EL HARA - avatar
+ 2
Thank you 😀
27th Apr 2018, 3:23 PM
KHALIFA EL HARA
KHALIFA EL HARA - avatar
+ 1
you can put user input as function argument c = Conv.F2C(int(input())) or just call it after getting input i = int(input()) print(Conv.F2C(i))
27th Apr 2018, 6:33 AM
Qwertiony
Qwertiony - avatar
0
there is no one solution. you can do somthing like this: encapsulate conversion methods.. class Conv: def F2C(f): #static return 'make your f to c conversion' def other_conversion_func():... usage: c = Conv.F2C(100)
26th Apr 2018, 10:35 AM
Qwertiony
Qwertiony - avatar