0

Hey guys where i am doing this wrong help me

lists= input() user_list= lists.split() final_list=[] for i in range(len(user_list)): new= i.replace(i[0],"") now=new+i[0]+"py" final_list.append(now) for x in range(len(final_list)): print(final_list[x],end=" ")

14th Apr 2020, 7:27 AM
Raza Alam
Raza Alam - avatar
4 Answers
+ 1
for example if user_list = ["abc","def"] for i in range (len(user_list)): will be for i in range(2) now in loop i will become 0 and 1 so,basically u saying 0.replace() which wont work
14th Apr 2020, 7:42 AM
durian
durian - avatar
+ 1
Ohhhhhhh now i get it thank-you
14th Apr 2020, 7:44 AM
Raza Alam
Raza Alam - avatar
0
replace method is for string ,not int
14th Apr 2020, 7:38 AM
durian
durian - avatar
0
But where i am using int
14th Apr 2020, 7:39 AM
Raza Alam
Raza Alam - avatar