Y
Y
YraganTron2014-05-05 15:00:06
Python
YraganTron, 2014-05-05 15:00:06

In a two-dimensional list, you need to push a value of the form 2 * 2 = 4

There is a two-dimensional list. It is necessary to fill it with expressions of the form 2*2=4.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
throughtheether, 2014-05-05
@YraganTron

if I understand the task correctly, then something like this (python 2.7):

>>> a=[['{0}*{1}={2}'.format(row,col,col*row) for col in xrange (1,5)] for row in xrange(1,5)]
>>> a
[['1*1=1', '1*2=2', '1*3=3', '1*4=4'], ['2*1=2', '2*2=4', '2*3=6', '2*4=8'], ['3*1=3', '3*2=6', '3*3=9', '3*4=12'], ['4*1=4', '4*2=8', '4*3=12', '4*4=16']]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question