So i know its more basic stuff, but im trying to update a list outside a function.
Im making App where you ca n learn new words in diff types of games but basically the rest of the code is not important in this case.
Lets say i have a dict:
dict = {'jajko':'egg',
'szynka':'ham',
'mleko':'milk'
}
Now from that dict id like to make a list from which ill take index 0 and create another list with only 1 value so i dont have to make loop inside my app and pause it waiting for users answer.
Now wait for user to quess the value to the key. If you quess i remove index 0 from Result list and take next value as index 0 and so on untill list is empty.
Each time a player will press a Button inside the app he will run the function inside a class and play until list is empty.
Ive tried doing someting like this but im pretty sure im missing some basic stuff to make it happen. Everytime i run my func i remove value but when i start func again list is the same as it was on the beggining
dict= {'szynka':'ham','mleko':'milk','jajko':'egg'}
result = list(dict.items()).copy()
def lol():
mylist = [result[0]]
print(mylist[0][0])
input1 = input('kk: ')
if input1 != mylist[0][1]:
print('wrong')
elif input1 == mylist[0][1]:
print('ok')
del result[0]
print(result)
mylist = [result[0]]