Python Lab Revision Q29–72

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/17

flashcard set

Earn XP

Description and Tags

Vocabulary practice flashcards covering Python programming concepts, standard libraries (datetime, random, math), control structures, and syntax from Lab Questions 29 through 72.

18 Terms

1
New cards

Modulus Operator (%)

An arithmetic operator that returns the remainder of division; used in programs to identify even numbers when n%2==0n \% 2 == 0 and to extract the last digit via n%10n \% 10.

2
New cards

Leap Year Condition

A conditional statement verifying whether a year is evenly divisible by 400400, or divisible by 44 and not divisible by 100100 (written as: year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)).

3
New cards

range() Function

A built-in Python function generating a sequence of integers where the stop endpoint is excluded; for example, range(1, 11) yields values from 11 to 1010, and a negative step like range(10, 0, -1) decrements values.

4
New cards

Fibonacci Series

A sequence of numbers starting with 00 and 11 in which each subsequent term is generated from the sum of the preceding two numbers using the update rule a, b = b, a + b.

5
New cards

for-else Loop Construct

A control flow structure in Python where the else block executes only if the for loop finishes all iterations without encountering a break statement.

6
New cards

Floor Division Operator (////)

An operator that performs integer division by discarding the fractional part; utilized in digit reversal algorithms as n//10n // 10 to eliminate the last digit.

7
New cards

datetime.datetime.now()

A method in the datetime module that retrieves and returns the current local date and time.

8
New cards

datetime.date.today()

A method in the datetime module that returns only the current local date containing year, month, and day attributes.

9
New cards

strftime()

A datetime method used to format date and time objects into specific string formats using directives such as %H:%M:%S for time or %d-%m-%Y for dates.

10
New cards

random.randint(a, b)

A function in Python's random module that returns a pseudorandom integer inclusive of both specified endpoints aa and bb.

11
New cards

random.choice()

A function in the random module that selects and returns a single random element from a non-empty sequence such as a list or a range.

12
New cards

math.sqrt()

A function from the math module that returns the square root of a given non-negative number.

13
New cards

math.pow(a, b)

A mathematical function that computes the base value aa raised to the power bb (aba^b).

14
New cards

math.ceil()

A function from the math module that returns the smallest integer that is greater than or equal to a given decimal value (e.g., 4.24.2 rounds up to 55).

15
New cards

math.floor()

A function from the math module that returns the largest integer that is less than or equal to a given decimal value (e.g., 4.84.8 rounds down to 44).

16
New cards

math.factorial()

A function from the math module that computes the factorial of a non-negative integer nn, defined as the product of all integers from 11 to nn, where the factorial of 00 is 11.

17
New cards

date.fromisoformat()

A class method of datetime.date that parses an ISO formatted date string structured as YYYY-MM-DD into a date object.

18
New cards

math.pi

A mathematical constant in the math module representing the ratio of a circle's circumference to its diameter (π\pi), used to compute circle area (πr2\pi r^2) and circumference (2πr2\pi r).