Python Project for Intermediates
Calories Burned Calculator
In this Python project for intermediates you have to create a desktop application with the Tkinter library to calculate the energy expenditure of multiple sports like running or boxing and routine activities such as ironing or yoga.
Curious about how many calories did you burned during exercise? You can estimate your calorie expenditure by using a simple calculator and that is the program you will have to build in this Python project. The application works as follows:
The user will have a screen to enter several variables like the age or weight and the application will automatically display the calories burned during the exercise selected in the menu along with two other ratios. You will have to build dropdown menus, selection buttons and blank spaces to enter data.
- The graphical user interface (GUI): It involves the construction of the skeleton of the app with its corresponding Tkinter widgets.
- Populate the app with the data provided in a csv file and implement the formulas defined in the instructions to calculate the calories burned.
Daniel Gunn is a software developer based in the UK. He holds a Computer Science degree, and he currently works as a freelance programmer specialized in Python.
DIGITAL DOWNLOAD / CONTENT
You will receive an email with a ZIP file. The download is also available on your Practity account.
The ZIP file includes:
- INSTRUCTIONS: A PDF with the project description. It includes a short guidelines section, and a screenshot of the app so can visualize what you have to build.
- DATA: A csv file with all the data related to the activities and their categories.
- A “.py” file with the Python project source code (290 lines). The code provided in the solutions has been written by a senior developer, so it is clean and easy to understand. A great way to learn and adopt right habits to create quality software.
- A PDF similar to a Python project tutorial with detailed explanations of each chunk of code (14 pages). The instructor explains step by step what the code does and why.
This Python project for intermediates is also available with the PyQt platform.
WHAT YOU WILL PRACTICE
– Classes and methods. See here for more information.
– Tkinter Library. See here for more information.
– Conditional statements
– Loops (for) + enumerate
– Read csv files
– Errors and exceptions.
– Formatted String Literals (f-strings)
– “__init__” method
This Python project for intermediates is designed for students who have attended Python courses and feel comfortable with core Python concepts like loops, methods or functions definition. It is an excellent job to start building desktop applications and get familiar with the Tkinter library.
Tkinter is a popular library in Python that allows developers to create graphical user interfaces (GUIs) for their applications. It provides a wide range of tools and pre-built widgets (such as buttons, labels, entry fields, menus, etc) which can be easily customized and arranged to create the desired user interface and build interactive and visually appealing interfaces.
Tkinter is included in the standard Python distribution, which means that it is readily available for use without the need for any additional installations.
One of the main reasons why Tkinter is considered the best choice for this Python project for interemdiates is its simplicity and ease of use. The library has a straightforward and intuitive API that makes it easy to create desktop applications quickly.
Advantages of Tkinter
Another advantage of using Tkinter is its cross-platform compatibility. Applications built with Tkinter can run on different operating systems, such as Windows, macOS, and Linux, without any modifications. This makes it convenient for developers who want their applications to be accessible to a wide range of users.
Additionally, Tkinter offers excellent documentation and resources that make it easy for Python students to learn and utilize its features effectively. The official Python documentation provides detailed explanations and examples of how to use different widgets and features of Tkinter. There are also numerous tutorials and guides available online that can help you get started with Tkinter.
Object Oriented Programming in Python
It is also a beginner object oriented programming exercise, since you will you have to create classes and write methods to make the app work.
Object Oriented Programming (OOP) is a programming paradigm that is widely used in Python and many other programming languages. It is a way of organizing and structuring code that focuses on creating objects, which are instances of classes. In simple terms, an object is a combination of data and methods that operate on that data.
One of the main features of OOP is the use of classes. A class is a blueprint or template for creating objects. It defines the properties and behaviors that an object will have. For example, if we were creating a program to manage a library, we might have a class called “Book” that defines the properties of a book, such as its title, author, and genre. We can then create multiple instances of the “Book” class, each with its own unique set of values for these properties.
Methods are another important feature of OOP. A method is a function that is defined inside a class and operates on objects created from that class. It allows us to define specific behaviors or actions that an object can perform. For example, our “Book” class might have a method called “borrow_book” that allows users to borrow the book from the library. This method could include logic to check if the book is available and update its status accordingly.
Why learn OOP with this Python project?
Learning OOP is important for beginners for several reasons. Firstly, OOP provides a clear and organized way of structuring code. By using classes and objects, we can break down complex problems into smaller, more manageable pieces. This makes our code easier to understand and maintain.
Secondly, OOP promotes code reusability. By defining classes and creating objects, we can reuse existing code in new projects. This saves time and effort by eliminating the need to write the same code multiple times.
Usually, apps with graphical interface are built using classes, so this is an excellent exercise to practice the basics of OOP in Python.
If you need additional information, do not hesitate to contact us.