๐ถ ์์ ์์ค
str, n = input().strip().split(' ')
answer = ""
for i in range(n):
answer += str
print(answer)์ฝ๋๋ฅผ ์
๋ ฅํ์ธ์
๐ถ ์๋ฌ
for i in range(n): ์์ ์๋ฌ ๋ฐ์
TypeError: 'str' object cannot be interpreted as an integer
๐ถ ๋ด์ฉ
str, n = input().strip().split(' ')
ex) ์ ๋ ฅ : test 9
str = "test"
n = "9" (n์ ์ซ์๋ฅผ ์
๋ ฅํ์ง๋ง ๋ฌธ์ ํ์
์)
๋ฌธ์์ด์ธ n ๊ฐ์ range(n)์์ ์ ์์ฒ๋ผ ์ฌ์ฉํด์ ์๋ฌ ๋ฐ์
๐ถ ์กฐ์น
n = int(n)
๋ค์๊ณผ ๊ฐ์ด ์ ์ ํ์
์ผ๋ก ๋ณ๊ฒฝ
'๊ฐ๋ฐ > Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
(Python) ๊ฐ์ํ๊ฒฝ ์์ฑ (2) | 2024.11.29 |
---|---|
(Python) CondaError: Run 'conda init' before 'conda activate' (0) | 2024.11.28 |
(Python) strip, split, map, all ํจ์ (1) | 2024.11.27 |
(Python) len, count, input ํจ์ (0) | 2024.11.27 |
(Python) PRN ์ฅ์น๋ฅผ ์ด๊ธฐํํ ์ ์์ต๋๋ค. (1) | 2024.11.26 |