The playSound
function is taking a list of integers, and is going to play a sound for every different number. So if one of the numbers in the list is 1
, 1
has a designated sound that it will play.
def userNum(iterations):
myList = []
for i in range(iterations):
a = int(input("Enter a number for sound: "))
myList.append(a)
return myList
print(myList)
def playSound(myList):
for i in range(myList):
if i == 1:
winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
I am getting this error:
TypeError: 'list' object cannot be interpreted as an integer
I have tried a few ways to convert the list to integers. I am not too sure what I need to change. I am sure that there is a more efficient way of doing this. Any help would be very greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…