Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Let's add some numbers")
- input1 = input("First number> ")
- input2 = input("Second number> ")
- result = input1 + input2
- print(result)
- print("Let's make a sum with two numbers")
- num1 = input("Please enter your first number: ") #store number as string
- num2 = input("Please enter your second number: ") #store number as string
- total = int(num1) + int(num2) #cast numbers to integer to add them
- print(num1+ " + "+ num2+ " = "+str(total)) #cast total to string so it can be concatenated
- print("Let's make a subtraction with two numbers")
- num1 = input("Please enter your first number: ") #store number as string
- num2 = input("Please enter your second number: ") #store number as string
- total = int(num1) - int(num2) #cast numbers to integer to subtract them
- print(num1+ " - "+ num2+ " = "+str(total)) #cast total to string so it can be concatenated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement