python - Celsius and Fahrenheit converting with choices -


i new python, , trying make python program choose if want convert fahrenheit celsius. here program:

x = (raw_input("would convert fahrenheit(f) or celsius(c)?")) if x == "f":  y = (raw_input("what fahrenheit?"))  f = (int(y) - 32) * 5.0 / 9 print f  if x == "c":  n = (raw_input("what celsius?"))  z = (int(n) *9) / 5 + 32  print "and in fahrenheit, is:"  print z 

i tried change if x == "c" elif x == "c", gave me texterror. ideas?

just indent print:

x = raw_input("would convert fahrenheit(f) or celsius(c)?") if x == "f":     y = raw_input("what fahrenheit?")     f = (int(y) - 32) * 5.0 / 9     print f elif x == "c":     n = raw_input("what celsius?")     z = (int(n) * 9) / 5.0 + 32     print "and in fahrenheit, is:"     print z 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -