Need Explanation about these coding! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need Explanation about these coding!

counter=0 list1=["Hello!", "I'am","Happy","to","see","you",["Why","are","you","me?"]] while counter <= (len(list1)-2): print(list1[counter]) counter+=1 print("."*20) counter=0 while counter <= (len(list1)-1): if counter<=2: print(list1[len(list1)-1][counter]) elif counter <=(len(list1)-2): print(list1[counter-1]) else: print(list1[(len(list1)-1)][3]) counter+=1

30th Apr 2020, 7:55 PM
Moe Thet Tin
Moe Thet Tin - avatar
1 Answer
0
A bit general your request. Better describe which part you do not understand. First loop prints all items except the last one, which is an array. Second loop prints first three entries of that array (counter <= 2), then from entry three on again all of the outer Array, except the last entry. Finally the last entry of the inner array is printed.
1st May 2020, 10:07 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar