<jupyter_start><jupyter_text>Conditionals<jupyter_code>a = 10
b = 0
a > 1
if a > 1:
    print("a is greater than one")
word = 'Bird'

# Note: Double equals for a conditional vs single equals for assignment !
if word == 'Bird':
    print('Bird is the word.')
    
if word != 'Girt':
    print('The word is not girt.')
if 'ird' in word:
    print("'ird' is in Bird.")
    
letters = ['B', 'i', 'r', 'd']
if 'i' in letters:
    print("'i' is in letters.")<jupyter_output>'ird' is in Bird.
'i' is in letters.<jupyter_text>*Protip*: Long lines can be split across two or more using a backslash ('\')This can make your code more readable.There should be nothing after the backslash, including whitespace.Try to keep lines shorter than 78 characters for a PEP-8 style bonus.<jupyter_code>if 'I' not in 'team' or \
   'I' not in 'TEAM':
    print("There is no 'I' in team (or TEAM).")
# Boolean logic
# True and True => True
a > 1 and b <= 0
# True or False => True
a > 1 or b > 1
if a > 100:
    print("a is greater than one hundred")
elif a > 50:
    print("a is greater than fifty but less than one hundred")
else:
    print("a is less than fifty")
    
# For better or worse, there is no case/switch statement in Python - you just use if/elif/elif/else
# Truthyness
if a:
    print("A non-zero int is truthy")

if not (a - 10):
    print("The int 0 is 'falsey' ... not False => True !")

if '' or [] or () or dict():
    print("We will never see this since an empty string, list, tuple and dict are all 'falsey'")
    
if "    ":
    print("A non-empty string, even whitespace, is 'truthy")<jupyter_output>A non-zero int is truthy
The int 0 is 'falsey' ... not False => True !
A non-empty string, even whitespace, is 'truthy
{'fraction_non_alphanumeric': 0.12848837209302325, 'fraction_numerical': 0.012209302325581395, 'mean_word_length': 3.25990099009901, 'pattern_counts': {'":': 1, '<': 8, '<?xml version=': 0, '>': 18, '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': '135261', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 604, 'n_tokens_neox': 583, 'n_words': 257, 'path': 'workshops/docs/modules/notebooks/wip/conditionals.ipynb', 'repo_name': 'rksin8/python-workshop-base', 'size': '1720'}