<jupyter_start><jupyter_text>Booleans: Precidence and short-circuiting<jupyter_code>not --> and --> or
True or True and False
True or (True and False)
(True or True) and False<jupyter_output><empty_output><jupyter_text>Short-Circuiting  True or Y --> True False and Y -->   no matter what Y is<jupyter_code>a = 10
b = 2

if a/b >2:
    print('a is at least twice b')
a = 10
b = 0

if a/b >2:
    print('a is at least twice b')
a = 10
b = 1

if b and a/b > 2:
    print('a is at least twice b')
a = 10
b = None

if b > 0 and a/b > 2:
    print('a is at least twice b')
import string
help(string)
a = 'c'
a in string.ascii_uppercase
string.ascii_uppercase
string.digits
string.ascii_letters
name = 'Rich'
if name[0] in string.digits:
    print("Name cannot start with a digit")
name = '1Rich'
if name[0] in string.digits:
    print("Name cannot start with a digit")
name = ''
if name[0] in string.digits:
    print("Name cannot start with a digit")
name = ''
if len(name) and name[0] in string.digits:
    print("Name cannot start with a digit")
name = 'abc'
bool(name)
name = None
if len(name) > 0 and name[0] in string.digits:
    print("Name cannot start with a digit")
name = None
if name is not None and len(name) > 0 and name[0] in string.digits:
    print("Name cannot start with a digit")
name = None
if name and name[0] in string.digits:
    print("Name cannot start with a digit")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11777150916784203, 'fraction_numerical': 0.018335684062059238, 'mean_word_length': 3.6677631578947367, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '37380', 'license': 'Unlicense', 'n_tokens_mistral': 532, 'n_tokens_neox': 510, 'n_words': 207, 'path': 'my_classes/NumericTypes/booleans_precidence_short_circuiting.ipynb', 'repo_name': 'minefarmer/deep-Dive-1', 'size': '1418'}