1/24
Vocabulary flashcards covering Python operator symbols, their meanings, and key programming problems involving arithmetic, conditions, and attendance logic.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Arithmetic Operators
Symbols that perform basic math operations: +, -, *, /, //, %, **.
Adds two values together.
Subtracts the right operand from the left operand.
Multiplies two values.
/ (Division)
Divides the left operand by the right; returns a float.
// (Floor Division)
Divides and returns only the integer part of the quotient.
% (Modulus)
Returns the remainder of a division operation.
** (Exponentiation)
Raises the left operand to the power of the right operand.
Comparison Operators
Operators that compare two values and return True or False: ==, !=, >,
== (Equal to)
Returns True if both operands have the same value.
!= (Not equal to)
Returns True if operands have different values.
(Greater than)
Returns True if the left operand is larger than the right.
Returns True if the left operand is smaller than the right.
= (Greater than or equal to)
Returns True if the left operand is larger than or equal to the right.
Returns True if the left operand is smaller than or equal to the right.
Logical Operators
Keywords that combine Boolean expressions: and, or, not.
and
Returns True only when both conditions are True.
or
Returns True if at least one of the conditions is True.
not
Inverts the truth value of a condition.
input()
Built-in function that reads user input as a string from the console.
Problem 1: Basic Arithmetic Program
Reads two numbers and prints their addition, subtraction, multiplication, and division (handling division by zero).
Even-Number Check
num % 2 == 0 evaluates to True when the number is even.
Product-vs-Sum Condition
If the product of two numbers exceeds 1000, output their sum; otherwise output the product.
Attendance Percentage Formula
(attendedclasses / totalclasses) * 100 calculates a student's attendance rate.
Exam Attendance Rule
A student can sit for the exam only if attendance is 75% or higher.