Print Function in Python HackerRank Solution

Hello Programmers, In this post, you will know how to solve the Print Function in Python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.

Ezoicreport this adPrint Function in Python HackerRank Solution
Print Function in Python HackerRank Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Print Function in Python HackerRank Solutions

Ezoicreport this adProblem

The included code stub will read an integer,n , from STDIN.

Without using any string methods, try to print the following123..n:

Note that “…” represents the consecutive values in between.

Example

n=5

Print the string 12345.

Input Format

The first line contains an integer n.

Constraints

1<=n<=150

Output Format

Print the list of integers from 1 through n as a string, without spaces.

Sample Input 0

3

Sample Output 0

123

Print Function in Python HackerRank Solutions

from __future__ import print_function
if __name__ == '__main__':
    n = int(raw_input())
    # Print Function in Python - Hacker Rank Solution START
    for i in range(1,n+1):
        print(i,end='');
    # Print Function in Python - Hacker Rank Solution END

Disclaimer: The above Problem (Print Function in Python) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Next: List Comprehensions in Python HackerRank Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad