Print range of numbers on same line

python, python-2.7

Solution

Python 2

for x in xrange(1,11):
    print x,

Python 3

for x in range(1,11):
    print(x, end=" ") 

Problem

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. ``` for x in xrange(1,10): print x ``` I am trying to get this result. ``` 1 2 3 4 5 6 7 8 9 10 ```

Original source

Related problems