Giter Club home page Giter Club logo

pythonexercises's Introduction

English | Português

Resolving the exercises from "Curso em Vídeo - Python"

As I have been in the learning process since the end of 2020, and to improve my knowledge of programming, I remade all exercises from "Curso em Vídeo - Python" by Gustavo Guanabara. To add even more knowledge and make the most of my time, I'm doing the whole project in English (sorry for the mistakes), And in the process also learning a little more about Git and GitHub. None of the exercises in this project were copied from the teacher's answer, all were done at the beginning of the studies, and are being remade on my own, so it is likely to be different from the answer the teacher shows in the video, but in no way does it escape requested in the statement.

WORLD 01:

First Commands:

  • Ex001: ‘Create a program that writes "Hello World!" on the screen’
  • Ex002: ‘Make a program that reads a person's name, and shows a welcome message’

Primitive types and data outputs:

  • Ex003: ‘Create a program that read two numbers, and shows on the sum between them on the screen’
  • Ex004: ‘Make a program that read something on the keyboard, And shows on the screen it's primitive type, and all the information about it’

Arithmetic operators:

  • Ex005: ‘Make a program that reads a whole number, and shows your successor and predecessor on the screen’
  • Ex006: ‘Create an algorithm that reads a number and shows it's double, triple and square roots’
  • Ex007: ‘Develop a program that reads a student's two grades, calculates and displays his average’
  • Ex008: ‘Write a program that read a value in meters, and displays it converted to centimeters and millimeters’
  • Ex009: ‘Write a program that reads any integer, and shows your multiplication table on the screen’
  • Ex010: ‘Create a program that reads how much money a person has in their wallet, and shows how much dollars they can buy’
  • Ex011: ‘Make a program that reads the width and height of a wall, calculate your area and the required amount of paint to paint it, knowing that each liter of paint paints an area of 2m²’
  • Ex012: ‘Make an algorithm that reads the price of a product, and show it's new price with a 5% discount’
  • Ex013: ‘Make an algorithm that reads an employee's salary, and shows his new salary with a 15% increase’
  • Ex014: ‘Write a program that converts a entered temperature, from °C to °F’
  • Ex015: ‘Write a program that asks the number of kilometers traveled by a rental car and the number of days it was rented, calculate the price to pay, knowing that the car coast R$60.00 per day, and R$0.15 per km driven’

Using modules:

  • Ex016: ‘Create a program that reads any real number from the keyboard, and shows its entire portion on the screen’
  • Ex017: ‘Make a program that reads the length of the opposite leg and the adjacent leg of a right triangle, calculate and show the length of the hypo.’
  • Ex018: ‘Make a program that reads any angle, and shows on the screen the value of cine, cosine and tangent of that angle’
  • Ex019: ‘A teacher wants to raffle one of his four students to erase the board, make a program that helps him, by reading their name and writing the chosen name’
  • Ex020: ‘The same teacher from the previous challenge wants to draw the order of presentation of the student's works, do a job that reads the names of the four students and shows the order draw’
  • Ex021: ‘Make a python program that opens and plays audio from an mp3 file’

Manipulating text:

  • Ex022: ‘Create a program that reads a person's full name and show:
    • The name with all uppercase and lowercase letters
    • How many letters have the name without considering spaces
    • How many letters have the first name’
  • Ex023: ‘Make a program that reads a number from 0 to 9999, and shows each separate digit on the screen’
  • Ex024: ‘Create a program that reads the name of a city, and says whether or not it starts with the name 'SANTO'’
  • Ex025: ‘Create a program that reads the person's name, and says if they have 'SILVA' in their name’
  • Ex026: ‘Make a program that reads a sentence from keyboard, and shows
    • The letters 'A' appears many times
    • In what positions does she appear for the first time
    • In what positions does she appear for the last time’
  • Ex027: ‘Make a program that reads a person's full name, then show the first and last names separately’

Conditions part 01:

  • Ex028: 'Writes a program that makes the computer 'think' of an integer between 0 and 5,
    • And ask the user to try to find out what number was chosen by the computer
    • The program should write on the screen if the user won or lost the game’
  • Ex029: 'Write a program that reads the speed of car
    • If he exceeds the speed of 80km/h, show a message saying that he was fined
    • The fine will coast R$:7.00 for each km above the limit’
  • Ex030: ‘Create a program that reads a integer and shows on the screen whether it is ODD or EVEN’
  • Ex031: ‘Develop a program that asks the distance of a trip in kilometers, calculate the price of the trip, charging R$ 0,50 per km for trips up to 200km, and R$ 0.45 for longer trips’
  • Ex032: ‘Make a program that reads a any year, and shows whether if is LEAP or not’
  • Ex033: ‘Make a program that reads three numbers, and shows on the screen which is the largest and which is the smallest’
  • Ex034: ‘Write a program that asks for an employer's salary and calculates the amount of their increase,
    • For salaries greater than R$ 1250.00, calculate an increase of 10%
    • For less than of equals, the increases is 15%’
  • Ex035: ‘Develop a program that reads the length of three lines, and tell the user whether or not they can form a triangle’

Colors at the terminal:

  • Is already included in some of the exercises.

WORLD 02:

Nested conditions:

  • Ex036: ‘Write a program to approve the bank loan for the purchase of a house
    • Ask the value of the house, the buyer's salary and how many years he will pay
    • The monthly installment cannot exceed 30% of the salary or the loan will be denied’
  • Ex037: ‘Write a program that reads any integer and ask the user to choose the conversion base:
    • 1 for binary
    • 2 for octal
    • 3 hexadecimal’
  • Ex038: ‘Write a program that reads two whole numbers and compare them showing the message on the screen
    • The first value is higher
    • The second value is higher
    • There is no higher value, the two are equal’
  • Ex039: ‘Make a program that reads the year of birth of a young person and informs them, according to they age
    • If they are still going to apply for military service,
    • If it is time to enlist,
    • Or if they are past the time of enlistment
    • Your program should also show the time left or past the deadline’
  • Ex040: ‘Create a program that reads two notes from a student and calculates their average,
    • Showing a message at the end, according to the average reached:
    • Average below 5.0: FAIL
    • Average between 5.0 and 6.9: RECOVERY
    • Average 7.0 or higher: APPROVED’
  • Ex041: ‘The National Swimming Confederation needs a program that reads the year of birth of an athlete,
    • And shows his category, according to age:
    • Up to 9 years: Child
    • Up to 14 years old: Children
    • Up to 19 years old: Junior
    • Up to 25 years old: Senior
    • Above: Master’
  • Ex042: ‘Redo the challenge 035 of the triangles, adding the ability to show what type of triangle will be formed:
    • Equilateral: all sides equals,
    • Isosceles: two equal sides,
    • Scalene: all different sides’
  • Ex043: ‘Develop a logic that reads the weight and height of a person,
    • Calculate his BMI and show his status, according to the table bellow:
    • Under 18.5: Underweight
    • Between 18.5 and 25: Ideal weight
    • 25 to 30: Overweight
    • 30 to 40: Obese
    • Over 40: Morbidly obese’
  • Ex044: ‘Write a program that calculate the amount to be paid for a product,
    • considering its normal price and payment condition:
    • Cash/check: 10% discount
    • Cash on credit card: 5% discount
    • Up to 2 x on credit card: normal price
    • 3 x or more on credit card: 20% interest’
  • Ex045: ‘Create a program that makes the computer play JOKENPÔ with you’

Repeat structure ‘for’:

  • Ex046: ‘Make a program that shows on the screen a countdown to the fireworks burst, going from 10 to 0 with a pause of 1 second between them’
  • Ex047: ‘Create a program that shows on the screen all the even numbers that are in the interval between 1 and 50.’
  • Ex048: ‘Make a program that calculate the sum of all odd numbers that are multiples of 3, and are in the range 1 to 500’
  • Ex049: ‘Redo exercises 09 showing the multiplication table of a number that user choses, only now using a 'for' loop’
  • Ex050: 'Develop a program that reads six integers and shows the sum only of those that are even, if the value entered is odd, disregard it'
  • Ex051: 'Develop a program that reads the first term and the ratio of a PA, at the end, show the first 10 terms of this progression'
  • Ex052: 'Make a program that reads an integer and tells you whether or not it is a prime number'
  • Ex053: 'Create a program that reads any sentence and tells if it is a palindrome, disregarding the spaces'
  • Ex054: 'Create a program that reads the year of birth of seven people, at the end, show how many people are not yet of age and how many are already older'
  • Ex055: 'Make a program that reads the weight of five people. At the end, show which was the highest and lowest weight read.'
  • Ex056: 'Develop a program that reads the name, age and sex of for people. At the end of the program, show:
    • The average age of the group,
    • What's the name of the older man,
    • How many women are under 20.'

‘while’ Repititions:

  • Ex057: 'Make a program that reads the gender of a person, but only accepts the values 'M' of 'F'.
    • If it is wrong, ask for the typing again until it has a correct value.'
  • Ex058: 'Improve de game of challenge 028.2, where the computer will 'think' of a number from 0 to 10.
    • But now the player falls trying to add until he gets it right, showing in the end how many guesses it took to win.'
  • Ex059: 'Create a program that reads two values and show the folowing menu:
    • [1] Add
    • [2] Multiply
    • [3] Bigger
    • [4] Nem numbers
    • [5] Exit the program
    • Your program should perform the requested operation in each case.'
  • Ex060: 'Make a program that reads any number and shows its factorial.
    • Ex: 5! = 5 x 4 x 3 x 2 x 1 = 120.'
  • Ex061: 'Redo challenge 061, reading the first term and the ratio of an PA
    • Showing the first 10 terms of the progression using the while function.'
  • Ex062: 'Improve challenge 061 by asking the user if he wants to show some more terms. The program will close when he says he wants to show '0' terms.'
  • Ex063: 'Write a program that reads a number and integer 'n',
    • And show on the screen the 'n' first elements of a fibonacci sequence.
    • Ex: 0 > 1 > 1 > 2 > 3 > 5 > 8.'
  • Ex064: 'Create a program that reads several integers from the keyboard.
    • The program will only stop when the user enters the value '999', wich is the stop condition.
    • At the end, show how many numbers were entered and what was the sum between them (disregarding the flag).'
  • Ex065: 'Create a program that reads several integers from the keyboard.
    • At the end of the run, show the average of all values and which was the highest and lowest values read.
    • The program should ask the user whether or not he wants to continue to the values.'

Interupting ‘while’ repititions:

  • Ex066: 'Create a program that reads several integers from the keyboard.
    • The program will only stop when the user types '999', which is the stop condition.
    • At the end, show how many numbers were entered and what was the sum beteween them (disregarding the flag).'
  • Ex067: 'Make a program that shows the multiplication table of severel numbers one at a time, for each value entered by the user.
    • The program will be interupted when the requested number is negative.'
  • Ex068: 'Make a program that plays even or odd with the computer.
    • The game will only be interrupted when the player LOSES, showing the total of consecutive victories that he won at the end of the game.'
  • Ex069: 'Create a program that reads the age and sex of several people.
    • For each registered person, the program must ask if the user wants to continue or not.
    • At the end show:
    • How many people are over 18;
    • How many men were registered;
    • How many women are under 20.'
  • Ex070: '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:
    • What is the total spend on the purchase
    • How many products coast more than R$: 1000.00
    • What is the cheapest product name.'
  • Ex071: 'Create a program that simulates the functioning of an ATM.
    • At the beginning, ask the user what will be the amount to be withdraw (whole number)
    • And the program will inform how many bills of each amount will be delivered.
    • NOTE: Consider that the cashier has bills of R$50, R$20, R$10, R$1.'

WORLD 03:

Tuples:

  • Ex072: 'Create a program that has a fully populated tuple with a count in full, from zero to twenty Your program should read a number from the keyboard (between 0 and 20) and display it in full.'
  • Ex073: 'Create a tuple filled with the top 20 from the Brazilian soccer league table, in the order of placement. Then show:
    • The first 5;
    • The last 4 placed;
    • Teams in alphabetical order;
    • Wat position is the GRÊMIO team in.'
  • Ex074: 'Create a program that will generate five random numbers and put them in a tuple. After that, show the generated number language and also indicate the largest and smallest values that are in the tuple.'
  • Ex075: 'Develop a program that reads four values from the keyboard. At the end show:
    • How many times did the value p appear
    • In what position was the first value 3 typed
    • What were the even numbers.'
  • Ex076: 'Create a program that has a unique tuple with product names and their prices in sequence. At the end, show a peice list, organizing the data in tabular form.'
  • Ex077: 'Create a program that has a tuple with several words (don't use accents). After that, you must show, for each word, wich are its vowel.'

Lists part 01:

  • Ex078: 'Make a program that reads 5 numerical 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.'
  • Ex079: 'Create a program where the user can type several numerical values and enter them in a list. If the number alrealy exists in there, it will not be added. At the end, all the numerical values entered will be displayed, in ascending order'
  • Ex080: 'Create a program where the user can type five numerical values, and enter them in a list, already in the correct insertion position (without using sort()). At the end show the ordered list on the screen.'
  • Ex081: 'Create a program that will read multiple numbers and put them in a list. After that, show:
    • A - How many numbers were figured.
    • B - The list of values, ordered in descending order.
    • C - If valor 5 is entered and is or in not in the list.
  • Ex082: '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 vlaues you typed, respectively. At the end, show the content of the generated lists.'
  • Ex083: 'Create a program where the user types any espression that uses parentheses. Your application should analyze where the expression passed has open and closed parentheses in the correct order.'

Lists part 02:

  • Ex084: 'Make a program that reads names and weights of several people, saving everything in a list. At the end, show:
    • A - How many people were registered.
    • B - A list with the heaviest people.
    • C - A listing with the lighter people.'
  • Ex085: 'Create a program where the user can enter seven numeric vlaues and enter them in a simgle list that keeps the odd and even vlaues separete. At the end, show the odd and even values in ascending order.'
  • Ex086: 'Create a program that creates a 3x3 dimensional matrix and fills it with read by keyboard. At the end, show the matrix on the screen, with the correct formatting.'
  • Ex087: 'Improve the previous challenge, showing at the end:
    • A - The sum of all values entered.
    • B - The sum of the values in the third column.
    • C - The highest value in the second row.'
  • Ex088: 'Make a program that helps a MEGA-SENA player to create guesses. The program will ask how many games will be genereted and will draw 6 numbers between 1 and 60 for each game, registering everything in a list.'
  • Ex089: 'Create a program that reads multiple student's names and two grades and stores them in a composite list. At the end, show a report containing the average of each one and allow the user to show the grades of each individual student.'

Dictionaries:

  • Ex090: 'Make a program that reads a student's name and average, also saving the situation in a dictionary. At the end, show the content os the structure on the screen.'
  • Ex091: 'Create a program where 4 players roll a die and have a random result. 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.'
  • Ex092: 'Create a program that reads name, year of birth and work card and registers (with age) in a dictionary, if by choice the CTPS is different from ZERO, the dictionary will also receive the year of employment and salary. Calculate and add, in addition to age, how old the person will retire at.'
  • Ex093: 'Create a program that manages a football player's performance. The program will read the number of goals scored in each match. In the end, all will be stored in a dictionary, including the total goals scored during the championship.'
  • ex094: 'Create a program that reads multiple people's names, gendersm and ages, stores each person's data in a dictionary, and all dictionaries in a list. At the end show:
    • A - How many people registered
    • B - The average age
    • C - A list of womem
    • D - An above-average age list.'
  • Ex095: 'Enhance CHALLENGE 093 to work with multiple players by incluidng a sistem to view each player's achievement details.'

Functions part 01:

  • Ex096: 'Made a program that has a function called area(), which receives the dimensions of a rectangular terrain (width and length) and shows the area of the terrain.'
  • Ex097: 'Make a program taht has a function called write(), which takes any text as a parameter and displays a message with adatable size.'
  • Ex098: 'Make a program that has a function called counter(), which takes three parameters: Start, End and Step. Your program has to performer three counts through the created function:
    • A - From 1 to 10, from 1 to 1;
    • B - From 10 to 0, every 2;
    • C - A personalized count.'
  • Ex099: 'Make a program that has a function called larger(), which takes several integer-valued parameters. your program has to analyze all the highlights and say which one is the biggest.'
  • Ex100: 'Make a program that has a list called numbers and two functions called draw() and even_sum. The first function will draw 5 numbers and place them into the list and the second function will show the sum of all PAIR values draw by the previous function.'

Functions part 02:

  • Ex101: 'Create a program that has a function called vote() that will receive as a parametes the year of birth of a person, returning a literal value indicating wheter a person has a DENID, OPTIONAL or MANDATORY vote in elections.'
  • Ex102: 'Create a program that has a factorial() function that takes two parameters : The first one that indicates the number to calculate and the other one called show, which will be a logical value (optional) indicating whether or not the factorial calculation process will be shown on the screen.'
  • Ex103: 'Make a program that has a function called token(), which takes two optional parameters: a player's name and how many goals he scored. The program must be able to show the player's record, even if some data has not been entered correctly.'
  • Ex104: 'Create a program that has the readint() function, which will work similarly to Python's input() function, except that it validates to accept only a numeric value. Ex: n = readint('Enter a number: ').'
  • Ex105: 'Make a program that has a notes() function that can receive multiples grades from students and it will return a dictionary with the following information:
    • Number of notes;
    • Te highest grade;
    • The lowest grade;
    • The average of the class;
    • The situation (optional);
    • Also add the docstrings.'
  • Ex106: 'Make a mini-system 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.'

Modules and Packeges:

  • Ex107: 'Create a module called currency.py that has built-in functions increase(), decrease(), double(), half(). Also make a program that imports this module and uses some of these functions.'
  • Ex108: 'Adapt the code from challenge 107 by creating an additional function called currency() that can display the values as a formatted currency value.'
  • Ex109: 'Modify the function created in challenge 107 so that they accept one more parameter, informing wheter or not the value returned by them will be the currency() function, developed in challenge 108.'
  • Ex110: 'Add to the currency.py module created in the precious challenges, a function called summary(), which shows on the screen some information generated by the functions we already have in the module created so far.'
  • Ex111: 'Create a package called utilitiesCeV that has two built-in modules called currency and data. Transfer all the functions used in challenges 107, 108, 109 to the first package and keep every running.'
  • Ex112: 'Within the utilitiesCeV package that we created in challenge 111, we have a module called data. Create a function called readmoney() that is capable of working like the input() function, but with a data validation to only accept values that are monetary.'

Error and Exception Handling:

  • Ex113: 'Rewrite the readint() funciton we did in challenge 104, now including the possibility of typing a number of a valid type. Enjoy and also create a readfloat() function with the same functionality.'
  • Ex114: 'Create a Python code that tests whether the "pudim.com" site is accessible by the computer being used.'
  • Ex115: 'Create a small modularized system that allows you to register people by name and age in a simple text file. The system will only have 2 options: register a new person and list all registered people.'

pythonexercises's People

Contributors

claayton avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.