0

Needs some help with python

i d like to input a random word and get an output of this word with its characters in a list. for ex. input hello and get (h, e, l, l, o)

6th Jan 2017, 1:06 PM
Angel Our
Angel Our - avatar
2 Réponses
+ 1
You could use a list comprehension. word = input() alist = [i for i in word] print(alist) or word = input() alist = [] for char in word: alist.append(char) print(alist) Also ('h', 'e', 'l', 'l', 'o') is a tuple. List has square brackets and is mutable.
7th Jan 2017, 12:58 AM
Don
Don - avatar
+ 1
thank you
7th Jan 2017, 10:47 AM
Angel Our
Angel Our - avatar