-1
import sys
EPSILON = 1e-15

c = float(sys.argv[1])

t = c

while abs(t - c/t) > (EPSILON*t):

    t = (c/t + t)/2.0

print(t)

At the time of executing the program, the message below is given

Traceback (most recent call last):
  File "C:\Users\Sama_User\Desktop\1.py", line 3, in <module>
    c = float(sys.argv[1])
IndexError: list index out of range
ArunPratap
  • 4,816
  • 7
  • 25
  • 43
masoud
  • 1
  • 1

1 Answers1

0

Are you passing arguments to your program ? Check the erroneous line c = float(sys.argv[1]). You need to run the program like python 1.py arg1 in order to access arg1

Tej
  • 215
  • 2
  • 8