GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — learn-python/src/operators/test_membership.py at master · scraggard/learn-python Expand file tree/ Copy pathtest_membership.pyMore file actions 25 lines (16 loc) · 782 Bytes / Copy pathtest_membership.pyFile metadata and controls25 lines (16 loc) · 782 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 """Membership operators @see: https://www.w3schools.com/python/python_operators.asp Membership operators are used to test if a sequence is presented in an object. """ def test_membership_operators(): """Membership operators""" # Let's use the following fruit list to illustrate membership concept. fruit_list = ["apple", "banana"] # in # Returns True if a sequence with the specified value is present in the object. # Returns True because a sequence with the value "banana" is in the list assert "banana" in fruit_list # not in # Returns True if a sequence with the specified value is not present in the object # Returns True because a sequence with the value "pineapple" is not in the list. assert "pineapple" not in fruit_list |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |