-2

I want to know how to print output in a single line

I want to print it like: 1234

instead of

1
2
3
4

Code:

 # n = (get in from user)
 i=1
 while (i<=n):
     print (i,)
     i +=1
khelwood
  • 52,115
  • 13
  • 74
  • 94

1 Answers1

0

This may help :

For Python 3:

print(i,end='')

For Python 2:

print(i),
GIRISH kuniyal
  • 620
  • 5
  • 13