Sep-08-2019, 05:50 AM
# Input from the command line import sys A = sys.argv[1] B = sys.argv[2] C = sys.argv[3] # Your code goes here num = A * (B + C/3 # Outputs print ( numAlright, hi folks. I'm trying to finish my homework assignment and I've gotta do so:
4. 2. Fix challenge 2
Note: Your arguments are strings unless they are converted into some other type. In this challenge, we are using decimals (float) rather than integers (int) for our type. So, you will need to tell Python to treat the variables as floating point decimal numbers by putting float(variable) in at the correct times.
I've tried
print(float(num))and even
num = (float(A*(B+C/3))but I get:
"Traceback (most recent call last):
File "fix2.py", line 9, in
num = A * (B + C/3)
TypeError: unsupported operand type(s) for /: 'str' and 'int'"
What am I doing wrong?