Oct-26-2020, 06:58 PM
Well, by calling random.Choice() on every line, the interpreter is selecting a different element each time. In essence, you have approximately a 3.5% chance of the code ever working. Instead, store the result of random.Choice() in a variable and then check that variable in your if...elif statement.
x = random.choice(insieme) if x == 'forbice': print('Hai perso :(') elif x == 'carta': print('Pareggio') elif x == 'sasso': print('Hai vinto!!')