New functions – subtraction, multiplication, and division
Now that we have created an addition()
function that accepts data from the user and converts it into numbers, we are ready to create functions for subtraction, multiplication, and division.
If you are coming back to this after a break, perform the following steps:
- Open your Python shell so that you can test your code as you write.
- Next, open your text editor (jEdit in Mac/Linux and Notepad ++ in Windows).
- Have both windows open on your desktop as you program.
- When you successfully write and test a line or a few lines of code in the Python shell, copy the lines into your text editor and then Save Your Work to the
first_calc.py
file that you created earlier in this chapter.
Tip
Save your work early ...
Get Python Projects for Kids now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.