Skip to content

Latest commit

 

History

History

0x04-python-more_data_structures

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

0x04. Python - More Data Structures: Set, Dictionary

Learning objectives for this project:

  • Why Python programming is awesome
  • 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

Tasks

  • 0-square_matrix_simple.py

    • Write a function that computes the square value of all integers of a matrix.
    • Prototype: def square_matrix_simple(matrix=[]):
    • matrix is a 2 dimensional array
    • Returns a new matrix:
      • Same size as matrix
      • Each value should be the square of the value of the input
      • Initial matrix should not be modified
      • You are not allowed to import any module
      • You are allowed to use regular loops, map, etc.
  • 1-search_replace.py

    • Write a function that replaces all occurrences of an element by another in a new list.
    • Prototype: def search_replace(my_list, search, replace):
    • my_list is the initial list
    • search is the element to replace in the list
    • replace is the new element
    • You are not allowed to import any module
  • 2-uniq_add.py

    • Write a function that makes the addition of all unique integers in a list (only one time each integer).
    • Prototype: def uniq_add(my_list=[]):
    • You are not allowed to import any module
  • 3-common_elements.py

    • Write a function that returns a set of common elements in two sets.
    • Prototype: def common_elements(set_1, set_2):
    • You are not allowed to import any module