+ 4

[CHALLENGE] Dissect a String and Add It To A List In Python?

Example: word = 'grass' Output: ['g','r','a','s','s]

8th Nov 2017, 6:08 AM
PoetšŸŽ­
PoetšŸŽ­ - avatar
6 Answers
+ 7
>>>word = 'grass' >>> res = list(word) >>> res
8th Nov 2017, 6:34 AM
šŸ‡³šŸ‡µBed Narayan Rai
šŸ‡³šŸ‡µBed Narayan Rai - avatar
+ 3
print(list("grass"))
8th Nov 2017, 7:36 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 2
word = input('Enter a word: ') List = [] for i in range (0,len(word)): List.append(word[i]) i += 1 print (List) ------------------------------------- OUTPUT >>> Enter a word: grass ['g', 'r', 'a', 's', 's'] >>>
8th Nov 2017, 7:57 AM
Thisun Dayarathna
Thisun Dayarathna - avatar
+ 1
# Python makes it easy print(list(input()))
14th Nov 2017, 3:36 AM
#RahulVerma
#RahulVerma - avatar
14th Nov 2017, 3:37 AM
#RahulVerma
#RahulVerma - avatar