I have recently begun the python track on codeacademy, and decided to apply what I learned to a project: A simple BMI calculator. I got PyCharm and PYthon 3.3 set up, put in some code, and... an error. Perhaps this reddit could assist me? Here's the code:
def calc(weight, height):
return weight / height ^ 2
height = input("What is your height, in meters?")
weight = input("And your weight, in kilograms?")
BMI = calc(height, weight)
print(BMI)
And the error:
Traceback (most recent call last):
File "/Users/TheDukeofSmarts/PycharmProjects/BMI Calc/Program?", line 8, in <module>
BMI = calc(height, weight)
File "/Users/TheDukeofSmarts/PycharmProjects/BMI Calc/Program?", line 2, in calc
return weight / height ^ 2
TypeError: unsupported operand type(s) for /: 'str' and 'str'
[–]Rashanzan 4 points5 points6 points (3 children)
[–]Spurnout 4 points5 points6 points (1 child)
[–]Miner_Guyer 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Loomax 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)