Using python I want to print a range of numbers on the same line. how can I do this using python, I can do it using C by not adding n
, but how can I do it using python.
JavaScript
x
3
1
for x in xrange(1,10):
2
print x
3
I am trying to get this result.
JavaScript
1
2
1
1 2 3 4 5 6 7 8 9 10
2
Advertisement
Answer
Python 2
JavaScript
1
3
1
for x in xrange(1,11):
2
print x,
3
Python 3
JavaScript
1
3
1
for x in range(1,11):
2
print(x, end=" ")
3