HackerRank:- Print function Discussions
Q:- The included code stub will read an integer, , from STDIN.
Without using any string methods, try to print the following:
Note that "" represents the consecutive values in between.
solutions:-
n= int(input("enter a number"))
for i in range (n):
print(i+1,end="")
here the end = ' ' will take next iteration as the argument and print it in the same line.
Comments
Post a Comment