Как печатать элементы в списке в одной линии Python
>>> l = [1, 2, 3]
>>> print(' '.join(str(x) for x in l))
1 2 3
>>> print(' '.join(map(str, l)))
1 2 3
Hurt Hedgehog
>>> l = [1, 2, 3]
>>> print(' '.join(str(x) for x in l))
1 2 3
>>> print(' '.join(map(str, l)))
1 2 3
lis_t = [1, 4, 5]
print(lis_t[2]) #will print 5
# list having all elements are strings
strings = ['string1', 'string2', 'string3', 'string4']
for string in strings:
print(string)
# using * operator
scores = [11, 12, 13, 14, 15, 16]
print(*scores)
# using for loop
scores = [11, 12, 13, 14, 15, 16]
for score in scores:
print(score)
from operator import length_hint
sample_list = ['Programming', 'with', 'Favtutor']
list_size = length_hint(sample_list)
print(list_size)