Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. 2. Fix challenge 2 (python) Note : Your arguments are strings unless they are

ID: 3725748 • Letter: 4

Question

4. 2. Fix challenge 2 (python)

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.

Fix the broken code:

# 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 ( num

Explanation / Answer

import sys
A = sys.argv[1]
B = sys.argv[2]
C = sys.argv[3]

# Your code goes here

A = float(A)

B = float(B)

C = float(C)
num = A * (B + C/3)

# Outputs
print ( num)

Output:

Arguements 1.1 2.2 3.3

3.63

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote