Python Arena
Step 3 of 5

Calculating with print

print can show the result of a calculation as well as text. Write the calculation without quotes:

print(4 + 9)
print(6 * 7)
print(1 + 3 * 5)
Output
13
42
16

Python uses + to add, - to subtract, * to multiply and / to divide. As in mathematics, multiplication and division come before addition and subtraction, so 1 + 3 * 5 is 16, not 20. Parentheses change the order: (1 + 3) * 5 is 20.

Quotes or no quotes

Quotes make all the difference. Without quotes, Python calculates. With quotes, the calculation is just text, printed exactly as it is written:

print(1 + 3 * 5)
print("1 + 3 * 5")
Output
16
1 + 3 * 5

Letting Python do the arithmetic is safer than doing it in your head and typing the answer: print(52 * 7) is easy to read and easy to check, and Python never makes a slip.

Your task

Challenge 1 of 3

Fill in the blank with a calculation, so the program prints the number of seconds in an hour (60 seconds in a minute, 60 minutes in an hour).

Challenge 2

Write a program that prints the number of minutes in a week. Let Python calculate it from the number of days in a week, hours in a day and minutes in an hour. The program should print:

Minutes in a week:
10080

Challenge 3

What does this program print? Type each line it prints.