I am new to programming and I am re-creating a game and there are loops that I created a temp variable to do a check and after the loop is done, I del temp.
i.e.
temp = True
while temp:
player_input = input('Do you want to start with 100 chips or 200 chips? [100 or 200]: ') # input is saved as str
if player_input == '100':
chips = 100
temp = False
elif player_input == '200':
chips = 200
temp = False
else:
print('That was invalid, try again.')
del temp
My question is, is this a good practice? I was thinking of using functions so I can use return 100 or return 200 but I will only do this once so it seems wasteful to keep a function in memory that I will only use once. I am not sure if keeping scrolling up and down on multiple functions for 1 setting at a time is readable, or switching between 2 different files (one main and one with all the functions) just for functions that will be used only once is readable either, but then again, this may not be readable to other as it is to me.
what would be the best practice to write the code above?