How do I print out the for statement horizontal?

Asked 2 years ago, Updated 2 years ago, 59 views

def divider(file,n): for i in range(0,len(file),n): yield file[i:i+n]

for i in range(3):

if i==0:
    name=open('first.txt','r')
elif i==1:
    name=open('second.txt','r')
elif i==2:
    name=open('last.txt','r')

infile=name.read().split()
file=[int (num) for num in infile]

name_list=list(divider(file,16))

for c in range(16):
    for r in range(16):
        if name_list[c][r]==0:
            print(" ",end=' ')
        else:
            print("*",end=' ')
    print('\n',end=' ')

The code is written vertically like a picture when you can run it, it's entered vertically like a picture crying How do I modify it to print it horizontally?

python for

2022-09-21 17:08

1 Answers

After creating and storing an array of 16,16,16, 
After the first line of the first letter, add the first line of the second letter, and then add the third line to the line

The second line after the first letter. The second line of the second letter

The first letter. The second letter after the third line

~


2022-09-21 17:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.