я не знаю как объединить значения в списке в 1 переменную(строку) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

я не знаю как объединить значения в списке в 1 переменную(строку)

пример: [hello,world,!] - helloworld! [test,spam,eggs] - testspameggs

21st May 2021, 6:40 AM
Marat Bahtyarov
Marat Bahtyarov - avatar
7 Answers
+ 1
What are you trying to do?? The task is all about, you just need to take the first letters of each word in the title and combine them. For that, logic goes something like this, for x in file: title=x.split() for a in title: print(a[0],end='') print() Anyway, the answer to your question is, you can use any of these 2 approaches.. l=['hello', 'world', '!'] print(*l, sep='') OR for i in l: print(i, end='')
21st May 2021, 6:51 AM
sarada lakshmi
sarada lakshmi - avatar
+ 1
thank you
21st May 2021, 7:02 AM
Marat Bahtyarov
Marat Bahtyarov - avatar
0
Have you tried it??
21st May 2021, 6:43 AM
sarada lakshmi
sarada lakshmi - avatar
0
yeah
21st May 2021, 6:44 AM
Marat Bahtyarov
Marat Bahtyarov - avatar
0
Show us your attempt.. So that we'll tell you, where you're going wrong
21st May 2021, 6:44 AM
sarada lakshmi
sarada lakshmi - avatar
0
https://code.sololearn.com/cC9Eh5PDNJqY/?ref=app i dint save attempts to combine them
21st May 2021, 6:46 AM
Marat Bahtyarov
Marat Bahtyarov - avatar
0
i recreate my attempt
21st May 2021, 6:51 AM
Marat Bahtyarov
Marat Bahtyarov - avatar