Entering Python 3 Two-Dimensional Array

Asked 1 years ago, Updated 1 years ago, 331 views

Hello, I'm a newbie who just started.

When you receive two-dimensional array input, you are taught to do the following.

I am familiar with the contents of the append, list, map, int, input, and split functions below. No matter how hard I think about it, I don't understand that the output value comes out pretty in the overlapping list.

It's a very basic question. It's funny, but... I might be pretty serious.

With the code below, the two-dimensional array goes into the overlapping list beautifully. Can you elaborate on that way?

mylist = []

for i in range(3) :
    mylist.append(list(map(int, input('').split())))

print(mylist)

python

2023-01-27 13:26

1 Answers

mylist = []

for i in range(3) :
  a = input('')
  print(a)
  a = a.split()
  print(a)
  a = map(int, a)
  print(a)
  a = list(a)
  print(a)
  print(mylist)
  mylist.append(a)
  print(mylist)


2023-01-27 18:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.