In this WSQ03 I ask the user to choose an operation i.e. sum, difference, product, division, or calculate the remainder, and then type in two integers for the code to solve.

The code prints the options and the user chooses by typing an integer (1,2,3,4,5). I assigned different numbers for each option and assigned somewhat similar values for each variable within the option.

if, elif, else

As you can see, the variable “c” does the actual operation of the variables “a” and “b” which are the integers typed by the user. If the user does not type an integer the code prints “Invalid Number”.

Screen Shot 2015-08-29 at 5.37.13 PM

FunWIntegers.py in action

Screen Shot 2015-08-29 at 6.05.39 PM

CC BY 4.0 WSQ03 by 5nbpppkkyj is licensed under a Creative Commons Attribution 4.0 International License.