For inside for and join | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

For inside for and join

for i in a: print("".join([k*v for k,v in i])) could someone explain this?

7th Feb 2018, 9:26 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
4 Answers
+ 20
"".join is used to convert list into string since in the 1st two elements k is none so only 5#s will be obtained by k*v thing... '#'*5=##### if there are other elements it will be evaluated accordingly... concept will be same... Good Luck with python
7th Feb 2018, 10:01 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 3
a is something like this [[(' ', 95)], [(' ', 14), ('#',5)....]] so when we run the code a word appear in hashs ### I didn't understand what has happend no enemurate used
7th Feb 2018, 9:55 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
+ 3
I think I have understand it thank you
7th Feb 2018, 10:04 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
0
while
8th Feb 2018, 11:42 AM
Слава Клишин
Слава Клишин - avatar