I write this code:
for i in range(0,7):
print(i)
so simply the output will be:
1
2
3
4
5
6
But i want to print like this:
1 2 3 4 5 6
how can I print this output like that.??
I write this code:
for i in range(0,7):
print(i)
so simply the output will be:
1
2
3
4
5
6
But i want to print like this:
1 2 3 4 5 6
how can I print this output like that.??
1) make a string first, then print it
" ".join([str(i) for i in range(0, 7)])
2) Duplicate answer How to print with out a new line
You should Google these things first...
You can do the following in Python3. If you want more information check out the documentation on the print function here. And you can read about the unpacking operator here.