Dec-19-2019, 12:39 PM
Hello Everyone,
I am new to Python programming and moving from MATLAB to python. I am still getting acquainted to python syntax and was trying a few exercises so that i could get a little comfortable and then start working on my projects. I am having troubles getting a float output. Below have pasted my code any help would greatly appreciated. Code works when there isn't decimal keyed in.
Thanks
Sai
I am new to Python programming and moving from MATLAB to python. I am still getting acquainted to python syntax and was trying a few exercises so that i could get a little comfortable and then start working on my projects. I am having troubles getting a float output. Below have pasted my code any help would greatly appreciated. Code works when there isn't decimal keyed in.
Thanks
Sai
def temp2(): Fahrenheit = input("Enter temp in F:") if Fahrenheit.isdigit(): fahrenheit_1 = int(Fahrenheit) C = (fahrenheit_1-32)*(5/9) print("Temp in Celcius is",C) elif Fahrenheit.isdecimal(): fahrenheit_1 = float(Fahrenheit) C = (fahrenheit_1-32)*(5/9) print("Temp in Celcius is",C) else: print("Input is wrong format")