HackerRank/해커랭크-Print Function-python

cosmos·2021년 4월 5일
2
post-thumbnail

문제📖

풀이🙏

  • The first line contains an integer n.
  • Print the list of integers from 1 through n as a string, without spaces.
    -> use join + list + range

코드💻

# hackerRank, print function, python
import sys

def solution(n):
    return ''.join(map(str, list(range(1, n + 1))))

if __name__ == '__main__':
    n = int(sys.stdin.readline())
    
    print(solution(n))

결과😎


출처 && 깃허브📝

https://www.hackerrank.com/challenges/python-print/problem
github

0개의 댓글