<jupyter_start><jupyter_text>List comprehension<jupyter_code>students_marks_above_80 = \
[student for student in student_marks if student[1] > 80]
students_marks_below_80 = \
[student for student in student_marks if student[1] < 80]
students_marks_above_80,students_marks_below_80
students_marks_above_80 + students_marks_below_80
sample_list = [1,2,3]
sample_list.extend([5,6])
sample_list
[1,2,3] + [5,6]
list_of_splits = []
# loop through input list
# create a sublist when you have iterated split_size elements
# append this sublist to the list_of_splits
x = [1, 2, 3, 4, 5]
split_size = 2
[[1,2],[3,4],[5]]
x = [1, 2, 3, 4, 5]
split_size = 7
[[1, 2, 3, 4, 5]]
def split_list(input_list,split_size):
    list_of_splits = []
    num_splits = len(input_list)// split_size
    even_splits = len(input_list) % split_size == 0
    num_splits = num_splits if even_splits else num_splits+1
    for i in range(num_splits):
        begin_marker = i*split_size
        list_of_splits.\
        append(input_list[begin_marker:begin_marker+split_size])
    return num_splits,list_of_splits
split_list([1,2,3,4,5],4)
x = [1,2,3,4,5]
x[0:2]
x[2:4]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12253641816623821, 'fraction_numerical': 0.05741216795201371, 'mean_word_length': 5.382513661202186, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '615998', 'license': 'MIT', 'n_tokens_mistral': 504, 'n_tokens_neox': 469, 'n_words': 101, 'path': 'Chapter02/Exercise21/Exercise21.ipynb', 'repo_name': 'vumaasha/python-workshop', 'size': '1167'}