I got this error while running some code.
Traceback (most recent call last):
File "C:/Users/jakus/PycharmProjects/practice/Practice.py", line 16, in <module>
x = x_values.pop(x)
IndexError: pop index out of range
Here is the code.
x_values = [1, 2, 3, 4, 5]
y_values = [6, 7, 8, 9, 10]
for x in x_values:
x = x_values.pop(x)
x == x**2
x_values.append(x)
for y in y_values:
y = y_values.pop(y)
y == y**2
y_values.append(y)
print(y_values)
print(x_values)
I am not sure how the pop index is out of range if it is currently working on that same variable in my for loop. I would appreciate any help that can be provided.