I am trying to call a function that will empty two lists that i send as arguments. How do i go about emptying the lists within the function and making sure they are empty once the code comes to reuse them in the original function in Python? Below is the code i am using as a test run for a larger system.
def Input():
nextRound = ['Dad', 'Mom']
maleNames = ['son', 'James', 'Mick', 'Dad']
a = int(input('Enter a number please'))
if a == 1:
ErrorInput(1, nextRound, maleNames )
# I want the below to print two empty strings
print(nextRound, maleNames)
def ErrorInput(error, namelist, round):
if error == 1:
print('ERROR: You have entered a number above what is impossible to
score')
namelist = []
round = []
elif error == 2:
print('ERROR: You Have entered a score meaning both players win')
namelist = []
round = []
elif error == 3:
print('ERROR: You have entered a score meaning neither of the two
players win')
namelist = []
round = []
elif error == 4:
print('EEROR: You have entered a negative number, this is
impossible')
namelist = []
round = []
return(namelist, round)
Input()