16
Олександр Мориконь
Last seen 1 month ago
Member for 6 years, 5 months, 23 days
Difficulty Normal
Good code but the variable n is not very clear, maybe better naming should have been used.
More
Very good, by the way, a new built-in function appeared in python 3.12, in module itertools:
flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']
unflattened = list(batched(flattened_data, 2))
unflattened
[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]
for batch in it
More
Good, but the last line is difficult to understand, I'm a fan of breaking such logic into several lines.
More