+ 12
How you can do like that sololearn?
First of all you write an incomplete code and even if it was complete then answer is wrong plz check my post. https://www.sololearn.com/post/453418/?ref=app
11 Réponses
+ 5
I had suggested an amendment here😂
https://code.sololearn.com/cwPPHzqFW5R7/?ref=app
+ 12
AJ Anant see here how it's answer can be int
https://www.sololearn.com/post/453412/?ref=app
+ 5
Mansi 👑 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Check here on each iteration table1 size is increasing till infinity. That's why you are getting that result.
@Mansi problem is in your code not in Sololearn compiler.
https://code.sololearn.com/cvxvi8yVBwgx/?ref=app
+ 3
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Here data is appending in table1 so each time table1 size will increase and loop will iterate till infinity and finally will throw an error.
+ 2
Mansi 👑 Ok got it. That is wrong quiz approval. You can report to Sololearn.
+ 1
Mansi 👑 Can you share your code so we can correct it because in your Code for loop is going till infinite because you are appending data in table1 so each time table1 size will increase and you will get this error.
You need to append data in another array.
+ 1
dict1={'a':1,'b':2,'c':3}
dict2={'a':4,'b':5,'c':6}
table1=[dict1,dict2]
for row in table1[:]: # <= iterate over a copy
row['a']=str(row['a'])
table1.append(row)
print(type(table1['b'])) # <= this will not work as the table is a list and indices must be
integers or slices
+ 1
Yeah! Sometimes it do happens with me as well.....but after making some nessecary changes it works