Monday, July 20, 2015

Intro to programming with Python - Tutorial 5, Exercise 1

This is the solution to the simple calculator exercise in the fifth tutorial in the introduction to programming with Python series.
The tutorial can be found here:
https://www.youtube.com/watch?v=-I1QcEA8a7A

For this exercise you have to write a python program that will prompt the user for an operation (add, subtract, multiply, divide) then prompt the user for two numbers and perform the operation on them and display the result to the user.

Here is a sample output when you run your calculator python program (call it calc.py):


The program itself should be simple enough. You can copy this code into a python file (calc.py) and execute it.
Please note that in python lines that start with the pound sign are comment lines.
Comment lines give information about the code but do not affect how it executes. Python will ignore them.

No comments:

Post a Comment