How you can do like that sololearn? | SoloLearn: Learn to code for FREE!

+8

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

6/30/2020 7:28:45 AM

Mansi 👑

11 Answers

New Answer

+2

I had suggested an amendment here😂 https://code.sololearn.com/cwPPHzqFW5R7/?ref=app

+10

AJ Anant see here how it's answer can be int https://www.sololearn.com/post/453412/?ref=app

+4

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

Mansi 👑 I'm telling you the actual format to post any Programming question here Use suitable title Tags must be relevant For showing your codes , save it in code playground and only share its link here Tell what is your problem & what help do you want from us in description Nothing more than that https://www.sololearn.com/Discuss/2349126/?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

AJ Anant dict1={'a':1,'b':2,'c':3} dict2={'a':4,'b':5,'c':6} table1=[dict1,dict2] for row in table1: row['a']=str(row['a']) table1.append(row) print(type(table1['b']))

+1

+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