<jupyter_start><jupyter_text>Python for Psychologists - Session 1 Homework assignment **Exercise 1**.Correct the typos in the list below. Afterwards evaluate the list so that you can see if the list contains the correct items now.<jupyter_code>typos = ["Mary", "has", "a", "liddle", "lamm", "its", "fleece", "was", "blue", "as", "snow"]<jupyter_output><empty_output><jupyter_text>**Solution**<jupyter_code>typos[3] = "little"
typos[4] = "lamb"
typos[8] = "white"
typos<jupyter_output><empty_output><jupyter_text>**Exercise 2**. Add together the first and the last element of the following list.<jupyter_code>integers = [1,6,36,7,22,80]<jupyter_output><empty_output><jupyter_text>**Solution**<jupyter_code>integers[0] + integers[-1]<jupyter_output><empty_output><jupyter_text>**Exercise 3**. Fetch a slice of the last two elements of the list `integers` and start counting from the end of the list (that is, starting with a minus sign)! **Solution**<jupyter_code>integers[-2:]<jupyter_output><empty_output><jupyter_text>**Exercise 4**. Add your own name to the list of typos. **Solution**<jupyter_code>typos.append("myName")
typos<jupyter_output><empty_output><jupyter_text>**Exercise 5**. Check if the 4th element of the list "integers" from above is equal to 13. **Solution**<jupyter_code>integers[3] == 13<jupyter_output><empty_output><jupyter_text>Optional exercises **Exercise 6**. Assign three new numbers to the slice from Exercise 3. Evaluate the list name again to see the result. **Solution**<jupyter_code>integers[-2:] = [3, 24,48]
integers<jupyter_output><empty_output><jupyter_text>**Exercise 7.** Subtract the 2nd from the 5th element of the `integers` list, divide the result by 4 and turn the result thereof into an integer. **Solution**<jupyter_code>int((integers[-2]-integers[1])/4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1388737014762165, 'fraction_numerical': 0.022963367960634227, 'mean_word_length': 7.798076923076923, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '351708', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 673, 'n_tokens_neox': 629, 'n_words': 176, 'path': 'session1/Assignment_Session1_solutions.ipynb', 'repo_name': 'dominikkraft/Python_for_Psychologists_winterterm2020', 'size': '1829'}