Computer Sci. Due 2:50 PM Python Mr. Manzoor DN=Define Source Code. Class: Add/Subtract program

Do Now: Define Source Code.

Class:
1. An expression many consist of:
Operand
Operations
Both Operand and Operators
None
2. ___________ returns True if X=5 and Y= 10;
X>=Y
X>Y
X==Y
X!=Y



Python Programming Question:

Q3. Write a program that takes two numbers and displays its addition and subtraction.

Notes: Change this a little bit (also has multiplication and division so you can remove those)
# Program published on https://beginnersbook.com

# Python program to perform Addition Subtraction Multiplication
# and Division of two numbers

num1 = int(input("Enter First Number: "))
num2 = int(input("Enter Second Number: "))

print("Enter which operation would you like to perform?")
ch = input("Enter any of these char for specific operation +,-,*,/: ")

result = 0
if ch == '+':
    result = num1 + num2
elif ch == '-':
    result = num1 - num2
elif ch == '*':
    result = num1 * num2
elif ch == '/':
    result = num1 / num2
else:
    print("Input character is not recognized!")

print(num1, ch , num2, ":", result)

Comments

Popular posts from this blog

Computer Science Manzoor Do Now Due 250 PM

Bday Math Pre-Calc M. Mui Pecentage increase/decrease do now Class: Jeopardy due 2:30 Pm

A Day English Due 2:30 PM DL-Do NowCareer Research- Ms.Casella