Question about lists | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Question about lists

How can I make a list from given strings without spaces? ex: string='hey hi' my_list=list[string] then my_list will be ['h', 'e', 'y', ' ', 'h', 'i']

13th Dec 2018, 1:45 PM
ģµœķ˜øģ¤€
1 Resposta
+ 5
Hi ģµœķ˜øģ¤€ You want to make a list of the characters in your string? Just use the list() function: my_string = "spam" my_list = list(my_string) print(my_list) # Output: ['s', 'p', 'a', 'm'] Hope that helps :)
13th Dec 2018, 1:50 PM
Kishalaya Saha
Kishalaya Saha - avatar