> From: John Joseph <[EMAIL PROTECTED]> > I am trying to use while loop , here I want > while loop to check for two conditions , I am not > getting an idea how to use while loop for checking > two conditions > I used "&" condition , but it is not > giving me the expected results > I used in this way > > while (condition no 1) & (condition no2): > print Results
Use 'and' instead of &. & is a bitwise logical AND - it operates on the individual bits of its arguments. 'and' treats the full operand as a logical value. The results can be different: >>> [1] & [2] Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unsupported operand type(s) for &: 'list' and 'list' >>> [1] and [2] [2] >>> 2 & 1 0 >>> 2 and 1 1 Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor