Print Function | HackerRank
Learn to use print as a function
www.hackerrank.com
Goal
Print the list of integers from 1 through give n as a string, without spaces
Solution
To solve this problem, you can use for statement and str class to convert integer value to string object.
# Print Function
if __name__ == '__main__':
n = int(input())
number = ""
for i in range(1, n+1, 1):
number += str(i)
print(int(number))
'software Engineering > (Python)HackerRank' 카테고리의 다른 글
[Python] HackerRank - Find the Runner-Up Score! (0) | 2023.01.29 |
---|---|
[Python] HackerRank -List Comprehensions (0) | 2023.01.28 |
[Python] HackerRank - Write a function (0) | 2023.01.26 |
[Python] HackerRank - Loops (0) | 2023.01.21 |
[Python] HackerRank - Python: Division (0) | 2023.01.20 |