Print Function in Python

Print Function in Python

Hello Friends, How are you? Today I am going to solve the HackerRank Print Function Problem in Python with a very easy explanation. In this article, you will get one or more approaches to solving this problem. So let’s start- {tocify} $title={Table of Contents} The included code stub will read an integer, n, from STDIN. Without using any string methods, try to print the following: 123……..n Note that “…” represents the consecutive values in between. The first line contains an integer n. Print the list of integers from 1 through n as a string, without spaces.

3 {codeBox}

123 {codeBox}

Approach I: Print Function HackerRank Python Solution

if __name__ == '__main__': n = int(input()) for i in range (1, n+1): print(i,end='')
No Comments

Sorry, the comment form is closed at this time.