'How to transform tuples
I have to create a function who gives me the differents operations that I have to do with 6 numbers to have the final number.
Here an example :
Final number: 50
my 6 number :
2,5,6,8,8,4,5
my result : 8*6+2=50 or 5*6+8+8+4= 50
.....
For the moment I did only the condition:
from random import *
# etat = nombre obtenu
randint(0, 20)
nombre1 = randint(0, 200)
nombre2 = randint(0, 200)
nombre3 = randint(0, 200)
nombre4 = randint(0, 200)
nombre5 = randint(0, 200)
nombre6 = randint(0, 200)
nombre_final = randint(1, 1000)
état_initial = (nombre1, nombre2, nombre3, nombre4, nombre5, nombre6)
etat_final = nombre_final
etat = (0, 0, 0, 0, 0, 0)
def gagner(etat):
return etat == etat_final
Problem here is that my etat is a tuple and etat_final is just a number, so it's a problem and I am searching a solution to resolve it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
