In this learning experience, I learnt the following:
- What are sets and how to use them
- What are the most common methods of set and how to use them
- When to use sets versus lists
- How to iterate into a set
- What are dictionaries and how to use them
- When to use dictionaries versus lists or sets
- What is a key in a dictionary
- How to iterate over a dictionary
- What is a lambda function
- What are the map, reduce and filter functions
The pycache directory is a directory created by Python3 to store compiled bytecode files, which are generated to improve the performance of Python code execution.
Prototypes for functions written in this project:
| File | Prototype |
|---|---|
0-square_matrix_simple.py |
def square_matrix_simple(matrix=[]): |
1-search_replace.py |
def search_replace(my_list, search, replace): |
2-uniq_add.py |
def uniq_add(my_list=[]): |
3-common_elements.py |
def common_elements(set_1, set_2): |
4-only_diff_elements.py |
def only_diff_elements(set_1, set_2): |
5-number_keys.py |
def number_keys(a_dictionary): |
6-print_sorted_dictionary.py |
def print_sorted_dictionary(a_dictionary): |
7-update_dictionary.py |
def update_dictionary(a_dictionary, key, value): |
8-simple_delete.py |
def simple_delete(a_dictionary, key=""): |
9-multiply_by_2.py |
def multiply_by_2(a_dictionary): |
10-best_score.py |
def best_score(a_dictionary): |
11-multiply_list_map.py |
def multiply_list_map(my_list=[], number=0): |
12-roman_to_int.py |
def roman_to_int(roman_string): |
100-weight_average.py |
def weight_average(my_list=[]): |
101-square_matrix_map.py |
def square_matrix_map(matrix=[]): |
102-complex_delete.py |
def complex_delete(a_dictionary, value): |
Task-0: The 0-square_matrix_simple.py file contains a function that computes the square value of all integers of a matrix.
Task-1: The 1-search_replace.py file contains a function that replaces all occurrences of an element by another in a new list.
Task-2: The 2-uniq_add.py file contains a function that adds all unique integers in a list (only once for each integer).
Task-3: The 3-common_elements.py contains a function that returns a set of common elements in two sets.
Task-4: The 4-only_diff_elements.py contain a function that returns a set of all elements present in only one set.
Task-5: The 5-number_keys.py file contains a function that returns the number of keys in a dictionary.
Task-6: The 6-print_sorted_dictionary.py file contains a function that prints a dictionary by ordered keys.
Task-7: The 7-update_dictionary.py file contains a function that replaces or adds key/value in a dictionary.
Task-8: The 8-simple_delete.py file contains a function that deletes a key in a dictionary.
Task-9: The 9-multiply_by_2.py file contains a function that returns a new dictionary with all values multiplied by 2
Task-10: The 10-best_score.py file contains a function that returns a key with the biggest integer value.
Task-11: The 11-multiply_list_map.py file contains a function that returns a list with all values multiplied by a number without using any loops.
Task-12: The 12-roman_to_int.py file contains a function that converts a Roman numeral to an integer.
Task-13: The 100-weight_average.py file contains a function that returns the weighted average of all integers tuple (<score>, <weight>)
Task-14: The 101-square_matrix_map.py file contains a function that computes the square value of all integers of a matrix using map
Task-15: The 102-complex_delete.py file contains a function that deletes keys with a specific value in a dictionary.