--Originally published at Tomas Enciso
Never in my life have a written a blog post so here it goes.
For the first post im gonna show a program I had to write that basically is a simple calculator and asks for your name, using inputs, outputs and some other fun stuff.
first of I started by printing “please enter your name” followed by an input that allows the user to enter his or her name. After that, this person will be greeted by hello (and the user’s name).
Using variables I was able to let the user choose two numbers and you would get the sum, subtraction, multiplication, the division with no decimals and the residue or the decimals of the previous division.
This is the code that I wrote:
print(“please enter your name”);
name = input(“”)
print(“Hello”,name)
x = int(input(“Please enter a number “))
y = int(input(“Now enter a different number “))
print(“If you sum these two numbers you get “,x + y)
print(“The subtraction of this two numbers is “,x – y)
print(“The multiplication of “, x, “and”, y, “is”,x * y)
print(“If you really want to know the division between”, x , “and”, y , “its”, x//y , “I guess…”) # no decimals included
print(“The remainder of this division is “, x % y, “im done, please make it stop”)
and here’s when you run it:
Tomass-MacBook-Pro-2:tecgda TomasEnciso$ python3 WSQ01.py
please enter your name
Tomas
Hello Tomas
Please enter a number 10
Now enter a different number 5
If you sum these two numbers you get 15
The subtraction of this two numbers is 5
The multiplication of 10 and 5 is 50
If you really want to know the division between 10 and 5 its 2 I guess…
The remainder of this division is 0 im done, please make it
Continue reading "WSQ01" →