+ 1

Can somebody please help me understand this

inNum = [2,4] inNum2= [4,5,6,7,8] for inNum2 in inNum: print(inNum2) Output: 2 4 Code: https://code.sololearn.com/cWZfqDMlHPHz/?ref=app

21st Oct 2020, 7:31 AM
ZUL ISKANDAR BIN ZAINORHAN -
ZUL ISKANDAR BIN ZAINORHAN - - avatar
2 Réponses
+ 2
inNum2 is first initialized by a list but after that it became a itterrator variable where values of list inNum are assigned to inNum2 and as inNum have 2 valued 2 , 4 so inNum2 prints both value in 2 times
21st Oct 2020, 7:48 AM
Ayush Kumar
Ayush Kumar - avatar
+ 3
It's like maths sets
21st Oct 2020, 7:32 AM
Ananiya Jemberu
Ananiya Jemberu - avatar