노력에는 지름길이 없으니까요

리스트를 문자열로 붙이기 본문

Python

리스트를 문자열로 붙이기

데건 2024. 6. 17. 17:58
728x90

 

https://school.programmers.co.kr/learn/courses/30/lessons/181841#

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

 

join을 쓰도록 하자.

def solution(str_list, ex):
    return ''.join([s for s in str_list if ex not in s])

 

 

 

똑같은 글자를 n번 붙이는 문자열을 만드는 법... * 사용하기

 

a, b = map(int, input().strip().split(' '))

for i in range(b) :
    for j in range(a) :
            print("*",end="")
    print(" ")

 

a, b = map(int, input().strip().split(' '))
answer = ('*'*a +'\n')*b
print(answer)
728x90
반응형