Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
1
Indexable
Never
def test(data,i):
available=[]
for x in data:
if type(x)==list:
for y in x:
if type(y)==list:
for z in y:
available.append(z)
else:
available.append(y)
else:
available.append(x)
if i==1:
if 'S1' in available and 'S2' in available and 'E1A' in available and 'E1B' in available and 'E1C' in available:
print('Reaction 1 done')
available.append('P1')
available.append('P2')
return available
if i==2:
if 'S3' in available and 'S4' in available and 'E2A' in available and 'E2B' in available:
print('Reaction 2 done')
available.append('P3')
available.append('P4')
return available
if i==3:
if 'S5' in available and 'E31' in available and 'E32' in available:
print('Reaction 3 done')
available.append('P5')
available.append('P6')
return available
if i==4:
if 'S7' in available and 'S8' in available and ('E4A' in available or ('E4B1' in available and 'E4B2' in available)):
print('Reaction 4 done')
available.append('P5')
available.append('P6')
return available
if i==5:
if 'P1' in available and 'P3' in available and 'P6' in available and 'P7' in available and 'E5' in available:
print('Reaction 4 done')
available.append('P5')
available.append('P6')
return ['YES']
return []
available=[['S1','S2'],['P1','P2'],['E1A','E1B','E1C']]   
for i in range(5):
available=test(available,i+1)
if available==['YES']:
print('P8 is Produced')