Solve 6.5.3
This commit is contained in:
parent
1a9d1f6386
commit
4fab27a9b0
|
@ -0,0 +1,20 @@
|
||||||
|
user_input= input()
|
||||||
|
lines = user_input.split(',')
|
||||||
|
|
||||||
|
# This line uses a construct called a list comprehension, introduced elsewhere,
|
||||||
|
# to convert the input string into a two-dimensional list.
|
||||||
|
# Ex: 1 2, 2 4 is converted to [ [1, 2], [2, 4] ]
|
||||||
|
|
||||||
|
mult_table = [[int(num) for num in line.split()] for line in lines]
|
||||||
|
|
||||||
|
def print_array(array):
|
||||||
|
result = []
|
||||||
|
for row in array:
|
||||||
|
result = []
|
||||||
|
for column in row:
|
||||||
|
result.append(column)
|
||||||
|
result.append('|')
|
||||||
|
result.pop()
|
||||||
|
print(*result)
|
||||||
|
|
||||||
|
print_array(mult_table)
|
Loading…
Reference in New Issue