Answer the question
In order to leave comments, you need to log in
How to write a segment of numbers in one line through tabulation (\t)?
I have a task where in the first line I need to write an indent and a segment of numbers (also through an indent) using the for loop, for example:
Input:
7
10
Output:
7 8 9 10
PS and I still haven’t figured out how to put tabs and spaces before lines I would be grateful if you could tell me how to do this.
Answer the question
In order to leave comments, you need to log in
tabulation is set
str = '\t' + '7'
str_space = ' '*10 + '7'
print(str)
7
print(str_space)
7
input = [1, 3, 5, 7]
print('\t'.join(str(i) for i in input))
print('{:>20}'.format('\t'.join(str(i) for i in input))
print('{}{}'.format(' '*30, '\t'.join(str(i) for i in input))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question