0

Im just now getting into python, and my assignment is to write a Celsius to Farenheit (and vice versa) converter. I get bonus points for having the degree symbol incorporated.

I want to have degree_symbol show up in the text of the initial input question

degree_symbol = chr(176)
temperature = input("Is your temperature in", degree_symbol, "F or", degree_symbol, "C?\n")

if temperature == "C":
    temp_c = float(input("What is your temperature in C?\n"))
    print("That is", ((temp_c * (9/5)) + 32), degree_symbol, "F!") 

else:
    temp_f = float(input("What is your temperature in F?\n"))
    print("That is", ((temp_f - 32) * (5/9)), degree_symbol, "C!")  

this is the error that shows up

    3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)]
Python Type "help", "copyright", "credits" or "license" for more information.
[evaluate -------_As01.py]
Traceback (most recent call last):
  File "C:/Users/-----------/----------_As01.py", line 10, in <module>
    temperature = input("Is your temperature in", degree_symbol, "F or", degree_symbol, "C?\n")
builtins.TypeError: input expected at most 1 arguments, got 5
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290
  • Also, see: http://pyformat.info – Wayne Werner Jan 14 '17 at 15:35
  • `input()` does not take multiple arguments, only `print()` works that way. Format your output into a string first. – Martijn Pieters Jan 14 '17 at 15:37
  • This may be your first question here, so I just want to say that aside from being a duplicate question it's pretty much a *perfect* question for SO. You provided a [mcve], you've actually shown us the *full* traceback. I mean really, this is a great question. If you follow this pattern of asking questions next time you have a problem, you should have very few problems here. Good job – Wayne Werner Jan 14 '17 at 15:38

0 Answers0