0

This is a one line code. What's it's mulitiline version?

Here is the one line [x for x, letter in enumerate(board) if letter == ' ' and x != 0] I need the multi line!

1st Aug 2020, 3:09 PM
Vishnu Ram M
Vishnu Ram M - avatar
7 Answers
+ 5
Vishnu Ram , your posted code is incomlete, please also post what the variable "board" is looking like. Thanks!
1st Aug 2020, 3:25 PM
Lothar
Lothar - avatar
+ 3
What is your try..? Expected? Can you try?.
1st Aug 2020, 3:15 PM
Jayakrishna 🇼🇳
0
I need the multi line code for this to understand it better.
1st Aug 2020, 3:20 PM
Vishnu Ram M
Vishnu Ram M - avatar
0
It means: for x, letter in enumerate(board) : if letter == ' ' and x != 0 : x Vishnu Ram Just transformed as it is to multiline....
1st Aug 2020, 3:28 PM
Jayakrishna 🇼🇳
0
This is the Board board = [' ' for x in range(10)]
1st Aug 2020, 3:55 PM
Vishnu Ram M
Vishnu Ram M - avatar
0
for x, letter in enumerate(board) : if letter == ' ' and x != 0 : what is this x for? x the last one
1st Aug 2020, 3:56 PM
Vishnu Ram M
Vishnu Ram M - avatar
0
x is Your first 1 liner code result, that is added to destination list iterately.. You are not mentioned that in code so I left it as it... Replace that with destination_list.append(x) If it is not clear, then add full code..
1st Aug 2020, 4:51 PM
Jayakrishna 🇼🇳