S3 STEM Python Revision Notes

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

1/31

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering core Python fundamentals, including variable rules, data types, operators, conditionals, loops, range mechanics, and list operations.

32 Terms

1
New cards

int

A Python primary data type representing whole numbers (positive or negative) without decimal points, such as 1010, −5-5, and 00.

2
New cards

float

A Python primary data type representing numbers containing one or more decimal places, such as 26.726.7, 3.143.14, and 1.01.0.

3
New cards

str

A Python primary data type representing text enclosed in single ('…') or double ("…") quotation marks, such as "Hello" or 'Python'.

4
New cards

bool

A Python primary data type representing truth values denoted by True or False.

5
New cards

Variable Naming Rules

Syntax rules in Python requiring variable names to contain letters, digits, and underscores (_), start with a letter or underscore, not start with a number, avoid special characters (such as ~ or @) and spaces, avoid reserved keywords, and remain case-sensitive.

6
New cards

print()

A built-in function that displays values on the screen and automatically creates a new line afterwards.

7
New cards

input()

A built-in function that pauses program execution and always returns user input as a string (str).

8
New cards

TypeError

An error caused by attempting to add an integer directly to a string returned by input() without converting the type.

9
New cards

Standard Division (/)

A basic arithmetic operator that divides numbers and always produces a float output.

10
New cards

Floor Division (//)

An arithmetic operator that truncates decimals and returns a whole integer.

11
New cards

Modulo (%)

An arithmetic operator that returns the remainder of a division operation.

12
New cards

Exponentiation (**)

An arithmetic operator that raises a base number to a power.

13
New cards

Equal To (==)

A comparison operator that evaluates whether two values are equal, unlike the single equals sign (=) which performs variable assignment.

14
New cards

or

A logical operator that evaluates to True if at least one condition is True.

15
New cards

and

A logical operator that evaluates to True only if both conditions evaluate to True.

16
New cards

not

A logical operator that inverts a boolean value, changing True to False and vice versa.

17
New cards

if Statement

A conditional statement that tests a condition and executes its indented block only if that condition evaluates to True.

18
New cards

elif Statement

Short for else if, a statement that tests subsequent conditions sequentially whenever previous conditions evaluate to False.

19
New cards

else Statement

A conditional statement that acts as the fallback block when none of the preceding conditions in the statement chain are met.

20
New cards

while Loop

A condition-controlled loop that repeatedly executes its code block as long as its specified condition remains True.

21
New cards

Loop Control Variable

A variable updated inside a while loop body (such as x=x+3x = x + 3 or count=count+1\text{count} = \text{count} + 1) to prevent an infinite loop error.

22
New cards

break Statement

A control statement that immediately terminates and exits a loop regardless of the loop condition.

23
New cards

for Loop

A loop that iterates over a sequence a predetermined number of times or through items in a collection.

24
New cards

range(stop)

A sequence generation function that produces integers from 00 up to stop−1\text{stop} - 1.

25
New cards

range(start, stop)

A sequence generation function that produces integers starting from start\text{start} up to stop−1\text{stop} - 1.

26
New cards

range(start, stop, step)

A sequence generation function that generates numbers from start\text{start} up to stop−1\text{stop} - 1, incrementing by the step value on each iteration.

27
New cards

String Repetition

An operation where multiplying a string by an integer duplicates the string a specified number of times (such as "*" * 33 yielding "***").

28
New cards

Python List

An ordered, mutable collection of items enclosed in square brackets [].

29
New cards

Zero-Based Indexing

An indexing convention used by lists where the first element is located at index 00, the second at index 11, and so forth.

30
New cards

IndexError

An error triggered when attempting to access a list index that is equal to or greater than the total length of the list.

31
New cards

len()

A built-in function that returns the total count of items in a list or characters in a string.

32
New cards

String Concatenation (+)

An operation using the plus (+) operator that joins multiple strings together end-to-end without adding automatic spaces.