129 - MiniProjects
129 - MiniProjects
• Create a folder in your workspace and open Jupyter Notebook in this folder.
• Create a notebook named “miniproject1.ipynb”
• Initialize 3 variables (a, b, c) and set values as given below :
• Variable “a” has a value of 8
• Variable “b” has a value of 9
• Variable “c” has a value of 10
• Write a program to ask a user his name, his first name and his age. The program must stock
the 3 values input by user in 3 variables called “name”, “first_name” and “age”.
• Convert the variable “age” into integer type with int() function.
• Bryan has 5 children : Joe, Katie, Maddy, John & William. He has a bag of 73 sweets.
Bryan wants to share all sweets between children, but Katie is punished. Bryan decides to share
sweets between Joe, Maddy, John & William. Katie will have the rest.
A. Write a program to help Bryan to share sweets. The variable sweets_per_children must store
the number of sweets per children and the variable sweets_for_katie have to store the
number of sweets for Katie.
B. Print these variables
Mini-project 4
• Dave is a museum director. He askes you to write a program to help him to sell tickets. The
price of tickets are :
• Child Tickets (< 11 y.o) = free
• Teenager Tickets (>= 11 y.o & < 18 y.o) = 5$
• Adult Tickets (>= 18 y.o & <= 65 y.o) = 10$
• Senior Tickets (> 65 y.o) = 7.5 $
• Write a program designed to calculate the price of tickets depending on number of tickets
sold and age of customers
Mini-project 5
• Write a program with a for loop to display the multiplication tables from 1 to 10
Mini-project 6
• You’ll code a mini-game ! The aim of game is to find a random number between 1 and 1000 in
5 try.
• The program must pick a random number between 1 and 1000 and ask to player a number
while the player does not find the correct number.
• Program have to display if the number input is higher or lower than random number
temperatures = [4,9,3,0,1,12,8]
• Mark is a seller in a computer shop. He has 5 computers and ran a benchmark software on
these computers (see results below).
Results :
• Calculate the average CPU score & average GPU score for all computers
Mini-project 9
• Store in variable “a” the second element of the first array in this 2D array.
two_d = np.array[[4,5,6,8,10],[9,4,5,8,10]]
• Store in variable “b” the first element of the second array in this 2D array above
Mini-project 10
• Multiplication tables again ! Code a program to display multiplication tables from 1 to 10 with
“np.full()” method. Create a 1D np-array with all tables.
table_zero = np.full(11,0)
for n in range(len(table_zero)):
table_zero[n] = table_zero[n]*n
Mini-project 11
Joe has a mathematic exercise : he has to subtract 4 of matrix (see below) and add 8.Then, he
has to multiply the matrix by 6 Write a program to do it.
matrix=np.array([[1,4,8], [9,4,3]])
Mini-project 13
• James, a meteorologist has a monthly report of temperatures in the form of Python list of
dictionaries.
reports = [{'day': 1, 'temperature': 0}, {'day': 2, 'temperature': 12}, {'day': 3, 'temperature': 17}, {'day': 4, 'temperature': 5},
{'day': 5, 'temperature': 12}, {'day': 6, 'temperature': -2}, {'day': 7, 'temperature': 8}, {'day': 8, 'temperature': 2}, {'day': 9,
'temperature': 13}, {'day': 10, 'temperature': 2}, {'day': 11, 'temperature': 16}, {'day': 12, 'temperature': 3}, {'day': 13,
'temperature': 13}, {'day': 14, 'temperature': -4}, {'day': 15, 'temperature': 10}, {'day': 16, 'temperature': -4}, {'day': 17,
'temperature': 15}, {'day': 18, 'temperature': 16}, {'day': 19, 'temperature': 17}, {'day': 20, 'temperature': -2}, {'day': 21,
'temperature': 0}, {'day': 22, 'temperature': -4}, {'day': 23, 'temperature': 8}, {'day': 24, 'temperature': 15}, {'day': 25,
'temperature': 7}, {'day': 26, 'temperature': -3}, {'day': 27, 'temperature': 8}, {'day': 28, 'temperature': 13}, {'day': 29,
'temperature': 8}, {'day': 30, 'temperature': 17}, {'day': 31, 'temperature': 2}]
• Find the minimum, maximum, mean & median temperatures recorded during the month with
numpy methods.
Mini-project 14
• Jim had his marks in French lessons. He wants put his marks into a Pandas data structures.
Create a DataFrame based on this array :
marks = [[15,18],
[13,14],
[12,11]]
• Jim had his marks in French lessons. He wants put his marks into a Pandas data structures.
Create a DataFrame based on this dictionnary :