Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- subplots
- 전처리
- interpolate
- IterativeImputer
- sklearn
- DataFrame
- 이상치
- SimpleImputer
- 누락값
- Seaborn
- KoNLP
- 데이터프레임
- 대치법
- MSE
- stopwords
- matplotlib
- 불용어
- koNLPy
- countplot
- 결측치대체
- 선형보간
- Boxplot
- Outlier
- 보간법
- BDA
- join
- 결측치
- 파이썬
- value_counts
- Python
Archives
- Today
- Total
ACAIT
[Python] 문자열: 백준 2675 문자열 반복 본문
2675번: 문자열 반복
문자열 S를 입력받은 후에, 각 문자를 R번 반복해 새 문자열 P를 만든 후 출력하는 프로그램을 작성하시오. 즉, 첫 번째 문자를 R번 반복하고, 두 번째 문자를 R번 반복하는 식으로 P를 만들면 된다
www.acmicpc.net
# 원래 문구 그대로 반복하는 것
n = int(input())
for i in range(1,n+1):
count, word = input().split() #input을 하면 int, str, chr 등 자료형 지정해 줘야 함
print(str(word)*int(count))
# 문구 인덱스끼리 반복하는 것
n = int(input())
for i in range(1, n+1):
num, word = input().split()
num = int(num)
word = str(word)
for j in word:
print(j*num, end='') # word[j]가 아니라 그냥 j라고 적어야 함. word의 글자 순서대로 불러오기 때문
print() # 줄넘김 처리