#WSQ03

This assisgment was a little bit trickier than the previous one, but still is fairly simple. All I needed to do is to ask the user to type 2 numbers and then make 4 different operations with such numbers.

For knowing how to write this code I again read some parts of the “Think Python” book.

http://www.greenteapress.com/thinkpython/thinkpython.pdf

I had a doubt about how to do the integer division so I searched online for the answer and this web page gave me the solution.

http://stackoverflow.com/questions/183853/in-python-what-is-the-difference-between-and-when-used-for-division

 

Here is my final code:

print (“This program will do some operations with 2 numbers you choose”)
print (“Type a number”)
num1=input ()
print (“Now type another number”)
num2=input ()
sub=int(num1) – int (num2)
multi= int(num1) * int (num2)
div= int(num1) // int (num2)
rem= int(num1) % int (num2)
print(“The difference of those numbers is”, sub)
print(“The product of those numbers is”, multi)
print(“The division of those numbers is”, div)
print(“The remainder of the division of those numbers is”, rem)

 

And this is the program:

numbers

numbers2

http://www.greenteapress.com/thinkpython/thinkpython.pdf

CC BY-SA 4.0 #WSQ03 by alextenablog is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.