< An Introduction to Python For Undergraduate Engineers
You can use simple Boolean expressions in logical statements such as those that we used in the while loop. The available expressions are:
Expression | Example | Description of example |
---|---|---|
and | while done==False and x<10: | keep looping whilst both done equals false and x is less than 10 |
or | if count==10 or value==5: | do something if variable count=10 or the variable value=5 |
not | while not done: | keep looping while the done variable is not 'True' |
This article is issued from
Wikibooks.
The text is licensed under Creative
Commons - Attribution - Sharealike.
Additional terms may apply for the media files.