풀이 1 )
n = int(input())
x = 1
for i in range(n):
for j in range(n):
if x > 10:
x = 1
print(x, end="")
x += 2
print("")
풀이 2)
n = int(input())
j = 0
for _ in range(n):
for _ in range(n):
print((2 * j + 1) % 10, end=' ')
j += 1
print()
풀이 3 )
number = int(input(''))
pnumber = 1
column = 1
row = 1
while row <= number and column <= number:
if pnumber > 10:
pnumber = 1
if column == number:
print(pnumber)
column = 1
row += 1
pnumber += 2
else:
print(pnumber, end = ' ')
column += 1
pnumber += 2
풀이 4 )
def odd_square(num):
a = 1
for i in range(0,num):
src = ""
for i in range(0,num):
src += str(a)
a = a+2
if a == 11:
a = 1
else:
continue
print(src)
num = int(input())
odd_square(num)
'배운다 > 파이썬' 카테고리의 다른 글
148 : 반복제어문3 - 형성평가9 (0) | 2020.07.25 |
---|---|
147 : 반복제어문3 - 형성평가8 (0) | 2020.07.25 |
145 : 반복제어문3 - 형성평가6 (0) | 2020.07.25 |
144 : 반복제어문3 - 형성평가5 (0) | 2020.07.25 |
143 : 반복제어문3 - 형성평가4 (0) | 2020.07.25 |