Ask Your Question

# Revision history [back]

### While loops

The goal to find the smallest value of a that satisfies the condition below. I realise I could use "if" instead of "while", but len(Lpathcellsdim4[s]) is big, and I want the computer to stop after it finds the first value of a satisfying the condition. I would be grateful for suggestions. Are there sage worksheets or tutorials to learn this type of thing? I have other, more complicated examples, where I want the computer to stop after it has found the first of many solutions.

The following gives an error "TypeError: argument of type 'sage.rings.integer.Integer' is not iterable"

b=0 for a in range(len(Lpathcellsdim4[s])): while Lvectorspolyfacesdim5[Lpathcellsdim4[s][a][0]][Lpathcellsdim4[s][a][1]][Lpathcellsdim4[s][a][2]] not in Lsimppdim5[n][5][5]: b=b+1

 2 None FrédéricC 5011 ●3 ●42 ●109

### While loops

The goal to find the smallest value of a that satisfies the condition below. I realise I could use "if" instead of "while", but len(Lpathcellsdim4[s]) is big, and I want the computer to stop after it finds the first value of a satisfying the condition. I would be grateful for suggestions. Are there sage worksheets or tutorials to learn this type of thing? I have other, more complicated examples, where I want the computer to stop after it has found the first of many solutions.

The following gives an error "TypeError: argument of type 'sage.rings.integer.Integer' is not iterable"

b=0
for a in range(len(Lpathcellsdim4[s])):
while Lvectorspolyfacesdim5[Lpathcellsdim4[s][a][0]][Lpathcellsdim4[s][a][1]][Lpathcellsdim4[s][a][2]] not in Lsimppdim5[n][5][5]:
b=b+1b=b+1

 3 None Emmanuel Charpentier 6214 ●6 ●44 ●123

### While loops

The goal to find the smallest value of a that satisfies the condition below. I realise I could use "if" instead of "while", but len(Lpathcellsdim4[s]) is big, and I want the computer to stop after it finds the first value of a satisfying the condition. I would be grateful for suggestions. Are there sage worksheets or tutorials to learn this type of thing? I have other, more complicated examples, where I want the computer to stop after it has found the first of many solutions.

The following gives an error "TypeError: argument of type 'sage.rings.integer.Integer' is not iterable"

b=0
for a in range(len(Lpathcellsdim4[s])):
while Lvectorspolyfacesdim5[Lpathcellsdim4[s][a][0]][Lpathcellsdim4[s][a][1]][Lpathcellsdim4[s][a][2]] not in Lsimppdim5[n][5][5]:
b=b+1