After reading lesson 6, you’ll be able to
- Read your first programming problem
- Walk through two possible solutions
- Write your first Python program
Here are some of the main ideas you should be familiar with so far:
- Programs are made up of a sequence of statements.
- Some statements initialize variables.
- Some statements can be expressions to do calculations.
- Variables should be given descriptive and meaningful names, especially to help future programmers who might be looking at the code.
- Some calculations you’ve seen so far are addition, subtraction, multiplication, division, remainder, and power.
- You can convert an object to a different type.
- The print command can be used to show output to the console.
- You should write comments in the code to document what the code is doing.
The problem
The first programming task you’ll see is to write a program in Python that converts minutes to hours. You’ll start with a variable that contains the number of minutes. Your program will take that number, do some calculations, and print out the conversion to hours and minutes.
Your program should print the result in the following way. If the number of minutes is 121, the program should print this: