Project: Pythonic Attempt 1

Produce the application.

Review of the chapter

In this chapter, we have covered the following:

  • The built-in functions in Python let us carry out useful tasks.

  • The print() function displays data on the screen—numbers as well as text strings.

  • The data can be saved in case-sensitive variables.

  • The + operator lets us add numbers and join text strings. (There is an extra space after the operator.)

  • The input() function can take input from the user’s keyboard when our code runs.

With these new skills at our disposal, let’s try to determine how many requirements of the final product we can meet.

Cheat sheet

This cheat sheet will help us take a quick look at useful commands while we write the code for the final product.

Python cheat sheet
Python cheat sheet

Review project requirements

Let’s look at the original product requirements to determine what portions of it we can create with the skills we have acquired so far. Remember, our client had asked us to make an app for the first graders to hone their basic maths skills.

The client's requirements
The client's requirements

Reduced project requirements

We know how to take input for the user’s name, and their answers against questions one by one—that takes care of requirements 1 and 5. We also know how to print customized messages on the screen, so requirement 2 also gets covered. What we haven’t covered yet is generating random maths questions, but for now, we can at least print pre-defined questions on the screen and ask the user to input their answer. The completed requirements are highlighted below.

The reduced requirements
The reduced requirements

Let’s have a go at the project and try to meet these requirements one by one. Solutions are provided after each part. Give each part an attempt, and if you can’t figure out how to do it, you may see the solution.

Flow of requirements
Flow of requirements