![]() |
| What area unit the opposite ways in which to understand if an inventory in Python is - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: What area unit the opposite ways in which to understand if an inventory in Python is (/thread-18691.html) |
What area unit the opposite ways in which to understand if an inventory in Python is - Smhbugra - May-27-2019 The easiest approach - if you recognize that the argument is often a listing is : if list_var: print(‘List is not empty’) else: print(‘List is empty’)This works as a result of Python variables have the construct of ‘truthiness’: id est they'll be used if they need a True/False price. List that area unit empty area unit thought-about to be False (or ’Falsey’) and then you'll use it as within the on top of snipping. The on top of may be a quite common idiom: you'll usually see it or it’s equivalent in several places. RE: What area unit the opposite ways in which to understand if an inventory in Python is - Yoriz - May-27-2019 Huh ? RE: What area unit the opposite ways in which to understand if an inventory in Python is - Larz60+ - May-27-2019 double huh?? |