<jupyter_start><jupyter_text>If Statements

 Basic example<jupyter_code>cars = ['audi', 'bmw', 'toyota', 'dodge']
for car in cars:
    if car == 'bmw':
        print(car.upper())
    else:
        print(car.title())<jupyter_output>Audi
BMW
Toyota
Dodge<jupyter_text>Conditional Tests

* equality test is `==`
* Case sensitive. Use .lower() to test something in a sort of case insensitive way.
* Inequality test is `!=`
* Logical and is `and`, likewise logical or is `or`
* Check if array contains value with `in`<jupyter_code>print('test' == 'Test'.lower())
print('test' != 'Test')
print((2 + 3) == 5 and (3 + 4) == 7)
print('test' != 'Test' or (2 + 2) == 7)
print('audi' in cars)<jupyter_output>True
True
True
True
True
{'fraction_non_alphanumeric': 0.16186556927297668, 'fraction_numerical': 0.012345679012345678, 'mean_word_length': 4.177304964539007, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '104954', 'license': 'MIT', 'n_tokens_mistral': 280, 'n_tokens_neox': 271, 'n_words': 81, 'path': 'Jupyter/PythonCrashCourse2ndEdition/ch5_if.ipynb', 'repo_name': 'awakun/LearningPython', 'size': '729'}