This repository contains my Python studies, including eg annotations and exercises. The exercises are from the Python course playlist made by Gustavo Guanabara's "Curso em Vídeo" (https://youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT-)
Exercise 001
Hello world
Exercise 002
Create a Python script that reads a person's name and displays a welcome message according to the value entered
Exercise 003
Create a program that reads two numbers and shows the sum between them
Exercise 004
Make a program that reads something from the keyboard and displays its primitive type and all possible information about it on the screen.
Exercise 005
Make a program that reads an integer and displays its successor and predecessor on screen
Exercise 006
Create an algorithm that reads a number and displays its double, triple, and square root:
Exercise 007
Develop a program that reads a student's two grades, calculates and displays their average
Exercise 008
Write a program that reads a value in meters and displays it converted to centimeters and millimeters
Exercise 009
Make a program that reads any integer and displays your times tables on the screen
Exercise 010
Create a program that reads how much money a person has in their wallet and shows how many dollars they can buy
Exercise 011
Make a program that reads the width and height of a wall in meters, calculates its area and the amount of paint needed to paint it, knowing that each liter of paint paints an area of 2m²
Exercise 012
Make an algorithm that reads the price of a product and shows its new price, with 5% off
Exercise 013
Make an algorithm that reads an employee's salary and shows their new salary, with a 15% increase
Exercise 014
Temperature converter: write a program that converts a typed temperature in °C to °F
Exercise 015
Car rental: Write a program that asks how many miles a rental car has traveled and how many days it has been rented. Calculate the price to pay, knowing that the car costs BRL 60 per day and BRL 0.15 per km driven
Exercise 016
Create a program that reads any real number on the keyboard and displays its entire portion on the screen.
Exercise 017
Write a program that reads the length of the opposite side (co) and adjacent side (ca) of a right triangle, calculate and show the length of the hypotenuse.
Exercise 018
Make a program that reads any angle and displays the sine, cosine and tangent value of that angle on the screen.
Exercise 019
A teacher wants to draw one of his four students to erase the board. Make a program that helps him by reading their name and writing the chosen one.
Exercise 020
The same teacher from the previous challenge wants to draw the order in which students' work is presented. Make a program that reads the names of the four students and shows the order drawn.
Exercise 021
Make a Python program that opens and plays an mp3 file
Exercise 022
Create a program that reads a person's full name
Exercise 023
Make a program that reads a number from 0 to 9999 and displays each of the separate digits on the screen
Exercise 024
Create a program that reads the name of a city and says whether or not it starts with the word "Santo"
Exercise 025
Create a program that reads a person's name and tells them if they have "Silva" in their name
Exercise 026
Make a program that reads any sentence and shows: How many times does the letter "a" appear. In what position does it appear the first time. In what position does it appear last time
Exercise 027
Make a program that reads a person's full name, then displays the first and last name separately
Exercise 028
Write a program that makes the computer "think" of an integer between 0 and 5 and ask the user to try to figure out which number the computer chose. The program should write on the screen if the user won or lost.
Exercise 029
Write a program that reads the speed of a car. If he goes over 80km/h, show a message saying he's been fined. The fine will cost R$7.00 for each km over the limit.
Exercise 030
Create a program that reads an integer and shows on the screen whether it is EVEN or ODD.
Exercise 031
Develop a program that asks the distance of a trip in Km. Calculate the price of the ticket, charging R$0.50 per Km for trips of up to 200km and R$0.45 for longer trips
Exercise 032
Make a program that reads any year and shows if it's LAP
Exercise 033
Make a program that reads three numbers and shows which is the largest and which is the smallest
Exercise 034
Write a program that asks for an employee's salary and calculates the amount of his raise. For salaries above R$1,250.00, calculate a 10% increase. For those who are inferior or equal, the increase is R$ 15%.
Exercise 035
Develop a program that reads the length of three lines and tells the user whether or not they can form a triangle
Exercise 036
Write a program to approve the bank loan for the purchase of a house. The program will ask the value of the house, the buyer's salary and in how many years he will pay. Calculate the amount of the monthly payment, knowing that it cannot exceed 30% of the salary or the loan will be denied
Exercise 037
Write a program that reads any integer
and ask the user to choose what the conversion base will be:
1 for binary
2 for octal
2 for hex
Exercise 038
Write a program that reads two whole numbers and compares them,
showing on the screen a message:
- the first value is higher
- the second value is higher
- there is no higher value; the two are the same
Exercise 039
Make a program that reads a young person's year of birth and reports
according to your age:
- If he's still going to enlist in military service
- If it's time to enlist
- If it's past the enlistment time
Your program should also show the time you missed or missed.
Exercise 040
Create a program that reads two grades from a student and calculates their average,
showing a message at the end, according to the average reached:
- average below 5.0: failed
- average between 5.0 and 6.9: recovery
- average 7.0 or higher: approved
Exercise 041
The National Swimming Confederation needs a program that reads
the year of birth of an athlete and show their category, according to age:
- up to 9 years old: child
- up to 14 years old: children
- up to 19 years old: junior
- up to 20 years old: senior
over 20: master
Exercise 042
Redo CHALLENGE 35 of triangles, adding the show feature
what kind of triangle will be formed:
- equilateral: all sides equal
- isosceles: two equal sides
- scalene: all different sides
Exercise 043
Develop a logic that reads a person's weight and height, calculate their BMI
and show your status, and according to the table below:
- under 18.5: underweight
- between 18.5 and 25: ideal weight
- 25 to 30: overweight
- 30 to 40: obesity
- over 40: morbidly obese
Exercise 044
Design a program that calculates the amount to be paid for a product,
considering its normal price, and payment terms:
- cash/check: 10% discount
- cash on the card: 5% discount
- up to 2x on the card: regular price
- in 3 installments or more on the card: 20% interest
Exercise 045
Create a program that makes the computer play Jokenpo with you.
Exercise 046
Make a program that shows on the screen. A countdown to the burst and fireworks. Going from 10 to 0, with a 1 second pause between them.
Exercise 047
Create a program that displays on screen all even numbers that are in the range between 1 and 50
Exercise 048
Write a program that calculates the sum of all odd numbers that are multiples of three (3) and that fall in the range 1 to 500.
Exercise 049
Redo the 009 challenge, showing the multiplication table of a number that the user chooses, but now using a fo loop
Exercise 050
Develop a program that reads six integers
and show the sum only of those that are even
If the value entered is odd, disregard it.
Exercise 051
Develop a program that reads the first term and reason
of an AP (Arithmetic Progression).
At the end, show the first 10 terms of this progression.
Exercise 052
Make a program that reads an integer and says whether or not it is
a prime number
Exercise 053
Create a program that reads any sentence
And say if it is a palindrome, disregarding the spaces
Exercise 054
Create a program that reads the year of birth of seven people
At the end, show how many people are not yet of legal age
and how many are already bigger
Exercise 055
Make a program that reads the weight of five people
At the end, show which was the highest and lowest weight read
Exercise 056
Develop a program that reads the name, age and gender of 4 people
At the end of the program, show:
- The average age of the group
- What's the older man's name
- How many women are under 20 years old
Exercise 057
Make a program that reads a person's sex
but only accept the "M" or "F" values.
If wrong, ask for typing again
until it has a correct value.
Exercise 058
Improve the CHALLENGE 028 game where the computer will "think"
in a number between 0 and 10.
Only now the player will try to guess until they get it right,
showing at the end how many guesses it took to win
Exercise 059
Create a program that reads two values and displays a menu
on the screen:
1: add up
2: multiply
3: bigger
4: new numbers
5: exit the program
Your program must perform the requested operation in each case.
Exercise 060
Make a program that reads any number and displays
your factorial
Exercise 061
Redo CHALLENGE 51, reading the first term and the reason for a PA,
showing the first 10 terms of the progression using
the while structure
Exercise 062
Improve exercise 61 by asking the user
if he wants to show some more terms
The program ends when it says it wants to show "0 terms"
Exercise 063
Write a program that reads any integer n
and show the first n elements and a Fibonacci sequence on the screen.
Exercise 064
Create a program that reads multiple integers from the keyboard. The program will only stop when the user enters the value 999, which is the stopping condition. At the end, show how many numbers were entered and what was the sum between them
Exercise 065
Create a program that reads multiple integers from the keyboard
At the end of the run, show the average between all values.
and which were the highest and lowest values read
The program should ask the user whether or not he wants to continue
to enter values
Exercise 066
Create a program that reads multiple integers from the keyboard
The program will only stop when the user enters 999,
which is the stop condition (flag).
At the end, show how many numbers were entered
and what was the acc between them
Exercise 067
Make a program that shows the times tables of several numbers,
one at a time, for each value entered by the user.
The program will be stopped when the requested number is negative
Exercise 068
Make a program that plays even or odd with the computer.
The game will only be stopped when the player loses,
showing the total consecutive victories he's won,
at the end of the game.
Exercise 069
Create a program that reads the age and gender of various people.
For each person registered, the program should ask
whether or not the user wants to continue.
At the end, it shows:
a) how many people are over 18 years old
b) how many men were registered
c) how many women are under 20 years old
Exercise 070
Create a program that reads the name and price of various products.
The program should ask if the user will continue.
At the end, show:
a) what is the total spent on the purchase
b) how many products cost more than BRL 1000
c) what is the name of the cheapest product
Exercise 071
Create a program that simulates the operation of an ATM.
At the beginning, ask the user what will be the amount to be withdrawn (integer)
and the program will inform you how many bills of each value will be delivered.
Note: Consider that the cashier has bills of R$50, R$20, R$10 and R$1.
num = int(input("What value do you want to get? \n"))
ballots = [50, 20, 10, 1]
Exercise 072
Create a program that has a fully populated tuple
with a full count from zero to twenty
Your program should read a number from the keyboard
(between 0 and 20)
and show it in full
Exercise 073
Create a tuple filled with the top 20 finishers
of the Brazilian Championship Table,
in the order of placement.
Then show:
a) only the top 5
b) the last 4 placed on the table
c) a list of teams in alphabetical order
d) which position in the table is the Chapecoense team
Exercise 074
Create a program that will generate five random numbers
and put in a tuple.
After that, show the list of generated numbers
and also index the smallest and largest values that are in the tuple.
Exercise 075
Develop a program that reads four values from the keyboard
and store them in a tuple.
At the end, show:
a) how many times did the value 9 appear
b) in which position the first value 3 was entered
b) what were the even numbers
Exercise 076
Create a program that has a single tuple
with product names and their respective prices,
in sequence
At the end, show a price list,
arranging data in tabular form
Exercise 077
Create a program that has a tuple with several words
(do not use accents).
After that, you must show, for each word,
what are your vowels
Exercise 078
Make a program that reads 5 number values and stores them in a list.
At the end, show which was the highest and lowest value entered
and their respective positions in the list.
Exercise 079
Create a program where the user can enter multiple numeric values
and register them in a list.
If the number already exists inside, it will not be added.
At the end, all the unique values entered will be displayed in ascending order.
Exercise 080
Create a program where the user can enter five numeric values
and register them in a list, already in the correct insertion position.
(without using sort()).
At the end, show the ordered list on the screen.
Exercise 081
Create a program that will read multiple numbers and put them into a list
After that, show:
a) how many numbers were entered.
b) the list of values, sorted in descending order
c) whether the value 5 was entered and is or is not in the list.
Exercise 082
Create a program that will read multiple numbers and put them in a list.
After that, create two extra lists that will contain only the even values.
and the odd values entered, respectively.
At the end, show the content of the three generated lists.
Exercise 083
Create a program where the user types any expression
that use parentheses.
Your application should parse whether the expression passed
has the parentheses open and closed in the correct order.
Exercise 084
Make a program that reads multiple people's names and weights
saving everything in a list.
At the end, show:
a: how many people were registered.
b: a listing with the heaviest people
c: a listing with the lighter people
Exercise 085
Create a program where the user can type
seven numerical values
and register them in a single list
that keep the odd and even values separate.
At the end, show the odd and even values
in ascending order.
Exercise 086
Create a program that creates a 3.3 matrix
and fill in values read by the keyboard.
At the end, show the matrix on the screen with the correct formatting
Exercise 087
Improve the previous challenge, showing at the end:
a: the sum of all entered even values
b: the sum of the values in the third column
c: the highest value of the second line
Exercise 088
Make a program that helps a MEGA SENA player to create guesses.
The program will ask how many games will be generated
and will draw 6 numbers between 1 and 60 for each game,
registering everything in a composite list.
Exercise 089
Create a program that reads multiple students' names and two notes
and save everything in a composite list.
At the end, show a bulletin containing the average of each
and allow the user to show each student's grades individually
Exercise 090
Make a program that reads a student's name and grade,
also saving the situation in a dictionary.
At the end, show the content of the structure on the screen.
Exercise 091
Create a program where 4 players throw a dice
and have random results.
Store these results in a dictionary.
At the end, put this dictionary in order,
knowing that the winner rolled the highest number on the dice
Exercise 092
Create a program that reads name, year of birth and work card
and register them (aged) in a dictionary.
If by chance the CTPS is different from zero, the dictionary will also receive
the year of hiring and salary.
Calculate and add, in addition to age, how old
the person will retire.
Note: retirement in 35 years of contribution.
Exercise 093
Create a program that manages a football player's performance.
The program will read the player's name and how many games he has played.
Then it will read the number of goals scored in each match.
In the end, all this will be stored in a dictionary,
including the total of goals scored during the championship.
Exercise 094
Create a program that reads the name, gender and age of various people,
saving each person's data in a dictionary
and all dictionaries in a list.
At the end, show:
The. How many people were registered
B. The average age of the group
ç. a list of all women
d. a list of all people above the average age.
Exercise 095
Upgrade CHALLENGE 093 to work with multiple players,
including a system for viewing achievement details
of each player.
Exercise 096
Make a program that has a function called area(), which receives dimensions of a rectangular terrain (width and length) and shows the terrain area
Exercise 097
Make a program that has a function called write(),
that receives any text as a parameter
and show a message with adaptable size.
Exercise 098
Write a program that has a function called counter(), which takes three parameters:
start, end and step
And count
Your program has to perform three counts through the created function
a) from 1 to 10, from 1 to 1
b) from 10 to 0, every 2
c) A custom score
Exercise 099
Write a program that has a function called larger(), which takes several integer-valued parameters.
Your program has to analyze all the values and say which one is the biggest.
Exercise 100
Make a program that has a list called numbers and two functions called raffle() and even_sum().
The first function will draw 5 numbers and place them into the list
and the second function will show the sum between all the even values drawn by the previous function.
Exercise 101
Create a program that has a function called vote()
which will receive as a parameter the year of birth of a person,
returning a literal value indicating whether a person has a vote
DENIED, OPTIONAL or MANDATORY in elections.
Exercise 102
Create a program that has a factorial() function that takes two parameters:
the first one that indicates the number to calculate
and the other called show, which will be a logical value (optional)
indicating whether or not the factorial calculation process will be shown on the screen.
Exercise 103
Write a program that has a function called token(), which takes two parameters:
a player's name and how many goals he has scored.
The program must be able to show the player's record, even if some data has not been entered correctly.
Exercise 104
Create a program that has the read_int() function,
which will work similarly to Python's input function,
only doing the validation to accept only a numeric value.
Exercise 105
Write a program that has a notes() function
which can receive multiple grades from students and will return a dictionary with the following information:
amount of notes
the highest grade
the lowest grade
the class average
the situation (optional)
Also add the function docstrings
Exercise 106
Make a minisystem that uses Python's interactive help
The user will type the command and the manual will appear.
When the user enters the word "END", the program will terminate!.
NOTE: use colors.