D
D
dimit20162018-10-02 05:33:17
Python
dimit2016, 2018-10-02 05:33:17

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

3 answer(s)
I
Igor Statkevich, 2018-10-02
@MadInc

tabulation is set

str = '\t' + '7'
str_space = ' '*10 + '7'
print(str)
    7
print(str_space)
          7

E
Eugene, 2018-10-02
@immaculate

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))

R
Ruslan., 2018-10-02
@LaRN

inp = (1, 3, 5, 7)
for x in inp:
    print(x, end='\t')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question