-
-
Save hxueh/24b4478c58eaa0d38ee62d2f89ad8311 to your computer and use it in GitHub Desktop.
<table class="table table-sm"> | |
<thead> | |
<tr> | |
<!--There are three empty cell in the first header--> | |
<th></th> | |
<th></th> | |
<th></th> | |
<!--s2 is the string2, according to application.py--> | |
{% for character in s2 %} | |
<th>{{character}}</th> | |
{% endfor %} | |
</tr> | |
<tr> | |
<!--Two empty cell in the second header--> | |
<th></th> | |
<th></th> | |
{% for i in range((s2)|length + 1) %} | |
<th>{{i}}</th> | |
{% endfor %} | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<th></th> | |
<th>0</th> | |
{% for i in matrix[0] %} | |
<th>{{i[0]}}</th> | |
{% endfor %} | |
</tr> | |
{% for t in range(s1|length) %} | |
<tr> | |
<th>{{s1[t]}}</th> | |
<th>{{t + 1}}</th> | |
{% for i in matrix[t + 1] %} | |
<td>{{ i[0] }}</td> | |
{% endfor %} | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> |
@eboisseau Oh, yeah! Just typos.
Hey there, if possible, could you please give an explanation as to how you accessed the elements of the matrix in line 34 and 35?
My doubt pertains to the fact of how this indexing valid, since the matrix we generated and returned in the back end is a matrix of tuples. I generated as a list of lists, and in general, to access the number I used the syntax like - matrix[i][j][0]
to get the number at that particular case, but here, the code successfully returns that value with just one indexing which is perplexing to me.
An explanation would be appreciated
I'm not 100% certain but I think you have to include helpers.py, I wrote it like this: "{% include "helpers.py" %}" but I can't check if it works because of other errors
Can you explain why you are using
range((s2)|length + 1)
Specifically what is length?
you mean
<td>{{ i[0] }}</td>
on line 35, don't you?