Python Operators & Basic Conditional Problems

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/24

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering Python operator symbols, their meanings, and key programming problems involving arithmetic, conditions, and attendance logic.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards

Arithmetic Operators

Symbols that perform basic math operations: +, -, *, /, //, %, **.

2
New cards
  • (Addition)

Adds two values together.

3
New cards
  • (Subtraction)

Subtracts the right operand from the left operand.

4
New cards
  • (Multiplication)

Multiplies two values.

5
New cards

/ (Division)

Divides the left operand by the right; returns a float.

6
New cards

// (Floor Division)

Divides and returns only the integer part of the quotient.

7
New cards

% (Modulus)

Returns the remainder of a division operation.

8
New cards

** (Exponentiation)

Raises the left operand to the power of the right operand.

9
New cards

Comparison Operators

Operators that compare two values and return True or False: ==, !=, >,

10
New cards

== (Equal to)

Returns True if both operands have the same value.

11
New cards

!= (Not equal to)

Returns True if operands have different values.

12
New cards

(Greater than)

Returns True if the left operand is larger than the right.

13
New cards
< (Less than)

Returns True if the left operand is smaller than the right.

14
New cards

= (Greater than or equal to)

Returns True if the left operand is larger than or equal to the right.

15
New cards

Returns True if the left operand is smaller than or equal to the right.

16
New cards

Logical Operators

Keywords that combine Boolean expressions: and, or, not.

17
New cards

and

Returns True only when both conditions are True.

18
New cards

or

Returns True if at least one of the conditions is True.

19
New cards

not

Inverts the truth value of a condition.

20
New cards

input()

Built-in function that reads user input as a string from the console.

21
New cards

Problem 1: Basic Arithmetic Program

Reads two numbers and prints their addition, subtraction, multiplication, and division (handling division by zero).

22
New cards

Even-Number Check

num % 2 == 0 evaluates to True when the number is even.

23
New cards

Product-vs-Sum Condition

If the product of two numbers exceeds 1000, output their sum; otherwise output the product.

24
New cards

Attendance Percentage Formula

(attendedclasses / totalclasses) * 100 calculates a student's attendance rate.

25
New cards

Exam Attendance Rule

A student can sit for the exam only if attendance is 75% or higher.