Computer Science Manzoor Do Now and Class due 2:50 PM

Q. What are Programming Errors?

In your own words, answer on google classroom

Notes: This means syntactically, the program compiles, but...

Errors are the mistakes or faults in the program that causes our program to behave unexpectedly and it is no doubt that the well versed and experienced programmers also makes mistakes. Programming error are generally known as Bugs and the process to remove bugs from program is called as Debug/Debugging.

Sometimes we get conditions from the data we have not tested.
D'oh (What Mr. F says when Programming error )







Classwork
Q1 . ___________ returns False if X=5 and Y= 10;
X>=Y
note: False x is NOT greater than nor equal to Y
X>Y
False X is NOT greater than Y

X==Y
False X is NOT equal to Y

X!=Y
True x is NOT equal to Y

Q2 . __________ is logical operator:
And
OR
Not
All
Note: ALL the above see notes below

Logical operators

Logical operators are the andornot operators.
Logical operators in Python
OperatorMeaningExample
andTrue if both the operands are truex and y
orTrue if either of the operands is truex or y
notTrue if operand is false (complements the operand)not x

Example #3: Logical Operators in Python

x = True
y = False

# Output: x and y is False
print('x and y is',x and y)

# Output: x or y is True
print('x or y is',x or y)

# Output: not x is False
print('not x is',not x)

Python Programming Question:

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

Note: modify below to accept the 2 numbers and
print the 3 lines of results for addition, subtraction, multiplication.
# 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