Skip to content

zstenger93/python_piscine

Repository files navigation

📖 Piscine: Python for Data Science

Day 1: Starting

Exercise 00

Exploring basic data objects

Exercise 01

Write a script to print time in a specific format

Exercise 02

Exploring object types

Exercise 03

All types of NULL in python

Exercise 04

The Even and the Odd

Exercise 05

Program, with a main, which takes a single string argument and displays the sums of its upper-case characters, lower-case characters, punctuation characters, digits and spaces

Exercise 06

Part 1:

Recode your own ft_filter, it should behave like the original built-in function (it should return the same thing as "print(filter.doc)"), you should use list comprehensions to recode your ft_filter.

Part 2:

Create a program that accepts two arguments: a string(S), and an integer(N). The program should output a list of words from S that have a length greater than N.

• Words are separated from each other by space characters.

• Strings do not contain any special characters. (Punctuation or invisible)

• The program must contain at least one list comprehension expression and one lambda.

• If the number of argument is different from 2, or if the type of any argument is wrong, the program prints an AssertionError.

Exercise 07

Make a program that takes a string as an argument and encodes it into Morse Code.

• The program supports space and alphanumeric characters

• An alphanumeric character is represented by dots . and dashes -

• Complete morse characters are separated by a single space

• A space character is represented by a slash /

You must use a dictionary to store your morse code.

Exercise 08

Create a function called ft_tqdm. The function must copy the function tqdm with the yield operator.

Exercise 09

Create a package in python the way you want, it will appear in the list of installed packages when you type the command "pip list" and display its characteristics when you type "pip show -v ft_package"

Day 2: Array

Exercise 00

Your function, give_bmi, take 2 lists of integers or floats in input and returns a list of BMI values. Your function, apply_limit, accepts a list of integers or floats and an integer representing a limit as parameters. It returns a list of booleans (True if above the limit). You have to handle error cases if the lists are not the same size, are not int or float...

Exercise 01

Write a function that takes as parameters a 2D array, prints its shape, and returns a truncated version of the array based on the provided start and end arguments. You must use the slicing method. You have to handle error cases if the lists are not the same size, are not a list ...

Exercise 02

Write a function that loads an image, prints its format, and its pixels content in RGB format. You have to handle, at least, JPG and JPEG format. You need to handle any error with a clear error message

Exercise 03

Create a program that should load the image "animal.jpeg", print some information about it and display it after "zooming".

• The size in pixel on both X and Y axis

• The number of channel

• The pixel content of the image.

• Display the scale on the x and y axis on the image

If anything went wrong, the program must not stop abruptly and handle any error with a clear message.

Exercise 04

Make a program which must load the image "animal.jpeg", cut a square part from it and transpose it to produce the image below. It should display it, print the new shape and the data of the image after the transpose.

Exercise 05

You need to develop 5 functions capable of applying a variety of color filters to images, while keeping the image shape the same.

You have some restriction operators for each function: (you can only use those given, you don’t have to use them all)

• invert: =, +, -, *

• red: =, *

• green: =, -

• blue: =

• grey: =, /

Day 3: DataTable

Exercise 00

Simply learn how to load a database from a csv file

Exercise 01, 02, 03

Create 3 diagramm about different parts of the data, 2 plot and 1 scatter

Day 4: OOP

Replayed Game of Thrones in python, genius references where the Lennister class takes everything

Day 5: Dod

Exercise 00

Statistic and kwargs

Exercise 01

inner functions, nonlocal variables

Exercise 02

Kinda same as 01 with extra functionality

Exercise 03

Dataclass and field option