but how do you convert a number to a floating point #?
all i know is how to either convert something to a integer or string
here is an example
#!/usr/bin/python
def fconvert():
fcconvert=True
while fcconvert:
temp=input("Fahrenheit temperature:")
if temp=="quit":#Will exit to main combo program if quit is entered
fcconvert=False
else:
temp=int(temp)#CONVERTS TO INTEGER!
print "That would be",((temp-32.0)*5.0)/9.0,"Celcius"
but how do i make it so that when you input something into the input you can even enter in fractions such as 1.34, because when i put in whole numbers it works but when i try puting in fractions this happens
>>>
Fahrenheit temperature:78
That would be 25.5555555556 Celcius
Fahrenheit temperature:6
That would be -14.4444444444 Celcius
Fahrenheit temperature:44
That would be 6.66666666667 Celcius
Fahrenheit temperature:2312
That would be 1266.66666667 Celcius
Fahrenheit temperature:5.2
Traceback (most recent call last):
File "/home/edwin/ProgrammingRELATED/PYTHONrelated/Edwinsprograms/ComplexProgramEVA'/FahrenheitToCelcius.py", line 29, in -toplevel-
fconvert()
File "/home/edwin/ProgrammingRELATED/PYTHONrelated/Edwinsprograms/ComplexProgramEVA'/FahrenheitToCelcius.py", line 26, in fconvert
temp=int(temp)#CONVERTS TO INTEGER!
ValueError: invalid literal for int(): 5.2
A error pops up when i enter in a # that isnt whole...[i entered 5.2 in this]
-------------------------------------------------------------------------------------------------------
Is there a option to change the input to a floating point number?
Or isnt it possible...
Thanks to anyone who answers!