из какого массива? из abc? блин( я торможу. я не понимаю. можно сделать как-то кроме функции и моего сооружения?
а еще у меня выводится не то, что нужно( при выборе 1 все отлично, а вот если в первый раз выбираешь ноль, то выводит сразу два значения =( я пробовала и в двух if'ах сделать одну переменную, и разные результат один! при выборе единицы все срабатывает, при нуле нет(
import random
count = 3
secondzerro = ''
zerro = ''
abc = {'a':0,'b':0,'c':0}
x = random.choice('abc')
abc[x]=1
print (abc)
choice = input('choose the variable, where 1 is: ')
print('your choice is: ',choice)
if choice in abc.keys():
if abc[choice] == 0:
secondzerro = [key for key in abc.keys() if key != choice and abc[key] == 0]
print ('This is a variable, where is 0: ',secondzerro)
if abc[choice] ==1:
zerro = random.choice([key for key in abc.keys() if key != choice])
print('This is a variable, where is 0: ',zerro)
decision = input('Do you want to change your choice? press Y for yes or N for no ')
if decision == 'y':
change = [key for key in abc.keys() if key != choice and key != secondzerro and key != zerro]
print ('your choice is changed to: ', change)
else:
print ('you entered something wrong')
#continue
exit()