0

Next Statement work around?

table ={1249.99: 36.30, 1749.99: 54.50, 2249.99: 72.70, 2749.99: 90.80, 3249.99: 109.00, 3749.99: 127.20, 4249.99: 145.30} x = 1000 y = next(x for x in table if x > 1000) work fines on the hand other doing it below gives a StopIteration y = next(x for x in table if x > x) any work around?

16th May 2017, 12:11 PM
RNB Cabanatan
RNB Cabanatan - avatar
2 ответов
+ 1
well idk what u r doing, but if x is any constant, then x > x is false. x can never be greater than itself
16th May 2017, 10:55 PM
Edward
0
yes your correct, but I need x to be constant. that is why I looking for a work around. hard coding the number (which is equal to x) works, but its not an option.
16th May 2017, 11:21 PM
RNB Cabanatan
RNB Cabanatan - avatar