[[+content_image]]
S
S
Svyatoslav Shavrovsky2015-10-03 21:59:28
Python
Svyatoslav Shavrovsky, 2015-10-03 21:59:28

What is a Python 3 construct?

Please sort it out: what is happening in this code fragment:
m = [[0 for x in s2 + 't'] for c in s1 + 't']
s1 and s2 are lines

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Sergey Novikov, 2015-10-03
@slawiko

This code builds a matrix (list of lists) of zeros, size len(s2) + 1 by len(s1) + 1 (where +1 is +'t'). It's just a short for for to create lists.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question