Computer Science, asked by smarteduhb9421, 1 year ago

Pls tell how to resolve this in python,, my code:
list=[]
userinput=input("write anything :- ")
list.append(userinput)
for z in userinput:
print(z)
delinput=input("write what u want to remove from the list :- ")
del list [delinput]
for z in list:
print(z,"is removed")
print(list)
after line 7 the traceback :typeerror: list indices must be integers, not str comes

Answers

Answered by chiefprashant
0

Answer:

#Python

Explanation:

its easy in line 7 change delinput = input("which you want to remove")

to

delinput= int(input("which....."))

and use Index no.s .....

done.

Similar questions