So I am following the Python 3 course on Codecademy. I am on the Lists section and I am trying out some code myself. I have made the following:
player_list = ["BOT Fred", "BOT Sam", "Player", "N2E", "Jet", "Jeff", "BOT 425", "Tim"] BOT_List =  for player in player_list: if player == "B" and player == "O" and player == "T": BOT_List.append(player) print(BOT_List)
I am trying to figure out if I have done the correct thing. I wish to print only the items in player_list which start with the letters B then O then T to BOT_List. This seems to work with the above code, however I am confused about the meaning of player, player and player.
I believe that the number in parentheses will refer to the whole element in the index. For example, print(player_list) will return “BOT Fred”. If I am correct about this, what does player refer to. Does it refer to the first letter in the first element in the list (letter B) or does it refer to the whole element (BOT Fred)?
This is my current logic about my code works (I am completely new to coding so hope this makes sense):
one by one, each element in player_list undergo the following:
1 - if the respective element(which we call player) in player_list starts with B and the second letter with O and the 3rd with T, then:
2- the code will add that element (player) to the BOT_List list
Once the loop is completed, the code will print the resulting BOT_List