COMP 110 QUIZ 02 flash

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

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards
==
Equal to
2
New cards
!=
Not equal to
3
New cards

>=

Greater than or equal to

4
New cards
<
Less than
5
New cards
or
Returns True if at least one condition is True
6
New cards
and
Returns True only if both conditions are True
7
New cards
not
Reverses the Boolean value (not True → False)
8
New cards
True or False and True
True (because 'and' runs first: False and True → False, then True or False → True)
9
New cards

logical operator precedence in Python

Arithmetic, Relational, not, and, or

10
New cards

if statement syntax

if condition:

do something

11
New cards
elif
Checks another condition if the first one is False
12
New cards
else
If all previous conditions are False
13
New cards
first letter of a word in Python
word[0]
14
New cards
f-string
Embeds expressions in strings using {} inside f""
15
New cards
positional argument
Value assigned based on position in the function call
16
New cards
keyword argument
Value assigned based on the name of the parameter
17
New cards
default parameter
A parameter with a default value in the function definition
18
New cards
default parameters placement
After non-default parameters
19
New cards

All caps with underscores, like PI = 3.14

named constant in Python

20
New cards
recursion
A function calling itself
21
New cards
base case
A condition that stops the recursion
22
New cards
recursive case
The part of the function that calls itself
23
New cards
recursion never stops
RecursionError: maximum recursion depth exceeded
24
New cards
base case for factorial(n)
If n == 0: return 1
25
New cards
edge case
A case that occurs at the boundary of valid input (e.g., n = 0)