I'm trying to accomplish 2 things here. First, I need to check a list, to see if a particular character is present on the list.
If the character is in the list, then I'd want to put that character into a separate list at the same exact spot in the index, and if it's not present, the list would just have a null in whatever spots don't have that letter. So hypothetically in the example below, if I'm checking for the letter L, I'd want to return a list that reads word2 = ['','','L','L',''].
I've been trying this with a for loop, but I can't seem to return what I'm looking for. Any help is greatly appreciated, thanks very much!
letter = 'L'
word = ['H','E','L','L','O']
word2 = []
for i in word:
if letter in word: