Nov-24-2020, 07:24 AM
Nov-24-2020, 07:32 AM
Here is a way
>>> word = "python" >>> list(word) ['p', 'y', 't', 'h', 'o', 'n']
Nov-24-2020, 07:45 AM
Yes, but then if I want to read the word into an array, than it reads all the letters into 1 index instead of putting the letters into separate indexes.
Nov-24-2020, 07:49 AM
I'm using ordinary Python lists, I don't know what you mean by 'array'
>>> word = "python" >>> L = list(word) >>> L ['p', 'y', 't', 'h', 'o', 'n'] >>> ''.join(L) 'python'
Nov-24-2020, 07:54 AM
By array I mean normal lists, and Is there a way I can send you a screenshot of what I mean?
Nov-24-2020, 07:55 AM
Let's take ambiguity out of the way. Are we talking about arrays or lists?
Other than that:
Other than that:
>>> list_ = list('python') >>> for item in list_: ... print(f'Letter {item} is at index {list_.index(item)}') ... Letter p is at index 0 Letter y is at index 1 Letter t is at index 2 Letter h is at index 3 Letter o is at index 4 Letter n is at index 5
Nov-24-2020, 07:58 AM
I mean lists, this is it:
n=input()
t=[]
t.append(list(n))
and than all the letters of the word go in the first index.
n=input()
t=[]
t.append(list(n))
and than all the letters of the word go in the first index.
Nov-24-2020, 08:33 AM
Don't
append
it (which adds the list into a single element), extend
it.word_letters = list("python") t = [] t.append(word_letters) print(f"After append, the first element is {t[0]}") t = [] t.extend(word_letters) print(f"After extend, the first element is {t[0]}")
Output:After append, the first element is ['p', 'y', 't', 'h', 'o', 'n']
After extend, the first element is p
Nov-24-2020, 08:39 AM
There is method for that. And this ain't append. It's extend:

Alternatively you can do something like this:
>>> list_ = list('python') >>> my_list = [] >>> my_list.extend(list_) >>> my_list ['p', 'y', 't', 'h', 'o', 'n']EDIT: ninjad by bowlofred

Alternatively you can do something like this:
>>> answer = 'python' >>> list_ = [*answer] >>> list_ ['p', 'y', 't', 'h', 'o', 'n']
Nov-24-2020, 08:40 AM
Thank you guys soo much for the help, it worked!!