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)
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
Post a Comment