Loading video player…

Python Basics Exercises: Numbers and Math (Overview)

In Python Basics: Numbers and Math, you learned the mathematical skills that you’ll need as a Python programmer. Now, you’ll take those skills to the next level by actively practicing and applying what you’ve learned.

In this hands-on course, you’ll have the opportunity to reinforce your understanding of numbers and math in Python programming through a series of exercises and coding challenges. By actively engaging with the material, you’ll gain the confidence you need to apply your learning in real-world scenarios.

In this course, you’ll practice:

  • Creating integers and floating-point numbers
  • Using arithmetic expressions, math functions, and number methods
  • Formatting and displaying numbers in strings
  • Taking numbers as user input

In working through these exercises, you’ll deepen your knowledge and solidify your understanding of the Python language. You’ll not only gain confidence in your programming abilities but also enhance your problem-solving skills.

This course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course. If you’re just getting started, then you might want to check out Python Basics: Setting Up Python before diving into this course.

Download

Sample Code (.zip)

3.4 KB
Download

Course Slides (.pdf)

9.8 MB

00:00 Welcome to this video course featuring exercises on using numbers and math in Python. In this short course, you’ll have the opportunity to test yourself by solving a few basic mathematical problems with Python.

00:14 This is a follow-up to another video course with a similar title that you should watch first. If you haven’t, then please follow the link listed in the description below, or click the link on the corresponding slide.

00:27 You can download the slides and other resources, including sample code by expanding the Supporting Material dropdown, which you’ll find just below this video.

00:37 Note that this is a part of the Python Basics Learning Path based on the book with the same title. If you arrived here by randomly browsing the entire Real Python video catalog, then consider starting from the beginning of Python Basics.

00:54 You are free to use whatever tool or code editor that you find most convenient, but throughout this course, you’ll write Python using built-in IDLE, which stands for Integrated Development and Learning Environment.

01:07 It should already come installed with your Python distribution, but if you’re having trouble finding it or are unsure how to use IDLE, then check out Setting Up Python, which is yet another course in the Python Basic series.

01:20 If you wish to take an even deeper dive into IDLE, then you can watch Starting With Python IDLE, or you can read the corresponding written tutorial.

01:30 To get the most out of this course, please follow these few steps. First, get familiar with the exercise and make sure that you understand the instructions correctly.

01:41 You don’t want to overlook any detail, as this could lead to solving the wrong problem. Then before throwing yourself into coding, grab a pen and paper to jot down your plan.

01:52 Think about how you want to approach the task. It often helps to break down a bigger problem into several smaller sub-problems in algorithm design. This is known as the divide-and-conquer principle.

02:05 Try to solve the exercise on your own first by putting your plan into action using Python. Finally, check your solution by comparing it to the expected answer.

02:15 Each exercise will be followed by a lesson where I’ll walk you through the thought process involved explaining the logic and related concepts.

02:24 Note that in computer programming, there are often many alternative solutions that can lead to the same correct outcome. If your solution looks a bit different than mine, but still works as expected, that’s perfectly fine.

02:37 Don’t worry if you get stuck, and remember that you learn more from failure than success. Feel free to reach out in the comments below if you have questions or feedback, or simply take a break and come back to an exercise later with fresh eyes.

02:53 With that out of the way, I can only wish you good luck.

Become a Member to join the conversation.