-
0. Squared simple
- 0-square_matrix_simple.py: Python function that computes the square value of all integers of a matrix.
- The parameter
matrixis a two-dimensional array. - Returns a matrix of the same size as
matrixwhere each value is the square of the input value. - The initial matrix is not modified.
- Without importing modules.
-
1. Search and replace
- 1-search_replace.py: Python function that replaces all occurences of an element by another in a new list.
- The parameter
my_listis the initial list. - The parameter
searchis the element to replace in the list. - The parameter
replaceis the new element. - Without importing modules.
-
2. Unique addition
- 2-uniq_add.py: Python function that adds all unique integers in a list (once for each integer).
- Without importing modules.
-
3. Present in both
- 3-common_elements.py: Python function that returns a set of common elements in two sets.
- Without importing modules.
-
4. Only differents
- 4-only_diff_elements.py: Python function that returns a set of all elements present in only one set.
- Without importing modules.
-
5. Number of keys
- 5-number_keys.py: Python function that returns the number of keys in a dictionary.
- Without importing modules.
-
6. Print sorted dictionary
- 6-print_sorted_dictionary.py: Python function that prints a dictionary by ordered keys.
- The function assumes all keys are strings.
- Keys are printed in alphabetic order.
- Keys are only sorted on the first level.
- Dictionary values can have any type.
- Without importing modules.
-
7. Update dictionary
- 7-update_dictionary.py: Python function that replaces or adds key/value pairs in a dictionary.
- The parameter
keyis always a string. - The parameter
valueis any type. - If a key exists in the dictionary, the value is replaced.
- If a key does not exist in the dictionary, it is created.
- Without importing modules.
-
8. Simple delete by key
- 8-simple_delete.py: Python function that deletes a key in a dictionary.
- The paramter
keyis always a string. - If the key does not exist, the dictionary does not change.
- Without importing modules.
-
9. Multiply by 2
- 9-multiply_by_2.py: Python function that returns a new dictionary with all values multiplied by 2.
- The function assumes all values are integers.
- Without importing modules.
-
10. Best score
- 10-best_score.py: Python function that returns a key value with the biggest integer value.
- The function assumes all values are integers.
- The function assumes all students have a different score.
- If no score is found, the functino returns
None. - Without importing modules.
-
11. Multiply by using map
- 11-mutiply_list_map.py: Python function that returns a
list with all values multiplied by a number using
map. - Returns a new length of the same length has
my_listwith each value multiplied bynumber. - The initial list is not modified.
- Without using loops or importing modules.
- 11-mutiply_list_map.py: Python function that returns a
list with all values multiplied by a number using
-
12. Roman to Integer
- 12-roman_to_int.py: Python function that converts a roman numeral to an integer.
- The function assumes the number will be between 1-3999.
- If the parameter
roman_stringis not a string orNone, the function returns0.
-
13. Weighted average!
- 100-weight_average.py: Python function that returns the weighted average of all integers in a list of tuples.
- Tuple format:
(<score>, <weight>). - If the list is empty - returns
0. - Without importing modules.
-
14. Squared by using map
- 101-square_matrix_map.py: Python function that computes
the square value of all integers of a matrix using
map. - The parameter
matrixis a two-dimensional array. - Returns a new matrix of the same size as
matrixwith each value squared. - The initial matrix is not modified.
- Without using loops or importing modules.
- 101-square_matrix_map.py: Python function that computes
the square value of all integers of a matrix using
-
15. Delete by value
- 102-complex_delete.py: Python function that deletes keys with a specific value in a dictionary.
- If the value does not exists, the dictionary is not changed.
- All keys having the searched value are deleted.
- Without importing modules.
-
16. CPython #1: PyBytesObject
- 103-python.c: C functions that print basic information about Python lists and Python bytes objects.
0x04-python-more_data_structures
Directory actions
More options
Directory actions
More options
0x04-python-more_data_structures
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||