/practice.py

In this repository, you will find a collection of Python programming exercises and examples to help beginners and experienced Python developers improve their coding skills and understanding of various Python concepts.

Primary LanguagePythonMIT LicenseMIT

Python Practice Exercises

This repository contains a collection of Python programming exercises and examples to help beginners and experienced Python developers improve their coding skills and understanding of various Python concepts.

The repository is organized into several directories, each containing a set of related exercises:

  1. basics: This directory contains basic Python exercises, such as learning about variables, data types, and basic arithmetic operations.
  2. control_flow: This directory covers control flow statements in Python, such as if-else statements, while loops, and for loops.
  3. functions: This directory includes exercises on defining and using functions in Python.
  4. data_structures: This directory covers Python data structures, such as lists, tuples, sets, and dictionaries.
  5. file_io: This directory contains exercises on reading and writing files in Python.
  6. oop: This directory includes object-oriented programming (OOP) exercises in Python, such as creating classes and objects, and using inheritance and polymorphism.
  7. error_handling: This directory covers error handling in Python, including try-except blocks and raising exceptions.
  8. modules: This directory includes exercises on using Python modules and libraries.
  9. advanced: This directory contains advanced Python exercises, such as using decorators, generators, and coroutines.

Each exercise in the repository is accompanied by a README file that provides a description of the exercise and a solution. Users can use the README files to understand the exercise requirements and verify their solutions.

To use the exercises in this repository, you can clone the repository to your local machine using the following command:

git clone https://github.com/Jao-br/practice.py.git

After cloning the repository, you can navigate to the directory containing the exercise you want to work on and open the corresponding README file in your preferred text editor or IDE. Follow the instructions in the README file to complete the exercise.

Feel free to contribute to this repository by submitting pull requests with new exercises or improvements to existing ones.

Table of Contents

  1. From 0 to 9999 and displays each of the separate digits on the screen.
  2. Check if a Brazilian city has a religious name.
  3. Check if a name contains "SILVA".
  4. Count the occurrences of the letter "A", its first and last positions.
  5. Display the first and last names separately.
  6. Guess a number between 1 and 5.
  7. Calculate a speeding fine.
  8. Check if a number is odd or even.
  9. Calculate the price of a trip.
  10. Check if a year is a leap year.
  11. Find the largest and smallest numbers.
  12. Calculate a loan installment.
  13. Convert numbers to binary, octal, or hexadecimal.
  14. Calculate the hypotenuse of a right-angled triangle.
  15. Calculate the area and paint needed for a wall.
  16. Calculate the new price with a discount.
  17. Calculate the new salary with a raise.
  18. Convert temperature from Celsius to Fahrenheit.
  19. Calculate the total price of a car rental.
  20. Extract the whole part of a number.
  21. Calculate the hypotenuse of a right-angled triangle (alternative).
  22. Calculate the sine, cosine, and tangent of an angle.
  23. Choose a random student to erase the board.
  24. Display the name in uppercase, lowercase, count letters, and first name letters.