Lol! Is there in Python like 'while i>0 && d>0' or while i,d>0? Or only one variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Lol! Is there in Python like 'while i>0 && d>0' or while i,d>0? Or only one variable?

Help!

12th Sep 2017, 7:36 AM
Bohdan
Bohdan - avatar
6 Answers
+ 2
@B. Gognoscere Python converts that kind of expression directly into a boolean. And you cannot compare more than two values with > A possibility would be while ( [i,n].all() != 0): If not you have to use 'and' operator
12th Sep 2017, 8:15 AM
spcan
spcan - avatar
+ 8
Booleans? None this: while (i, d>0): ?
12th Sep 2017, 7:56 AM
Bohdan
Bohdan - avatar
+ 7
I need to create decision to find a function value: z=1/xy as long as x,y!=0
12th Sep 2017, 7:57 AM
Bohdan
Bohdan - avatar
+ 6
I tried, the same error: IndentationError: expected an indented block
12th Sep 2017, 8:17 AM
Bohdan
Bohdan - avatar
+ 4
> is used for binary comparison. Thus, it can only compare 2 objects.
12th Sep 2017, 7:58 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
You can give the while method as many variables and expression you want, as long as they are booleans. You should put it between parenthesis though.
12th Sep 2017, 7:44 AM
spcan
spcan - avatar