Programming and Hobbies 2016-09-19 11:51:00

--Originally published at Programming and Hobbies

WSQ03 – Fun With Numbers

 

Well, in this ocasion I wanted to make and share with you guys one of the hw from the last year, today I made the WSQ03. Below you'll see the instructions that I follow to create my code.

What to Do



Click image for source.
Ask the user for two integer values, then use those two values to calculate and show the following:

  • The sum of the two numbers.
  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.
First of all I started my code with 2 inputs, so the user can introduce 2 integer numbers. I defined each one as a & b.
After this I started to do write down what I wanted to do: sum, rest, multiply, divide integers and with decimals.

  After that I open the python shell, and I ran the program


After that I wrote 2 random numbers, and then the program gave me the results 
 
Then I decided to try the program again just to make sure that it works correctly.


And that's it, to see more excercises go to http://kenscourses.com/tc101fall2015/tag/wsq/