-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
  • 55,782
  • 14
  • 81
  • 108

1 Answers1

0

This may help :

For Python 3:

print(i,end='')

For Python 2:

print(i),
GIRISH kuniyal
  • 740
  • 1
  • 5
  • 14