I want to create a for loop construct with a body that contains reassignment statements that I can use outside of the for loop.
nintendo_switch = []
split_container = []
game1 = None
game2 = None
game3 = None
a = ' '
b = ' '
c = ' '
container = 'Enter a videogame you would like to download \n'
game1 = str(input(container))
Enter a videogame you would like to download
fire emblem 3 houses
game2 = str(input(container))
Enter a videogame you would like to download
xenoblade chronicles 3
game3 = str(input(container))
Enter a videogame you would like to download
triangle strategy
split_container = [game1, game2, game3]
for i in split_container:
i = i.split()
I created a list with 3 variables that hold 3 different strings. I was expecting the for loop to execute a reassignment statement that would assign the results of the variable preforming the .split() method. Now that I think of it, i is one variable so the assignment statement will just be assigning to i, and not game 1, 2, or 3. Would are function be better for what im doing?