Python Fundamentals, Data Structures, and File Handling

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

1/34

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering core Python fundamentals, basic data structures (lists, tuples, dictionaries, sets), operators, control flow statements, functions, strings, and file handling mechanisms based on lecture slides.

35 Terms

1
New cards

Variable

A named location in memory used to store data, created dynamically in Python when a value is assigned using the assignment operator =.

2
New cards

Dynamic Typing

A feature where the Python interpreter automatically determines the data type of a variable at runtime without requiring explicit type declaration.

3
New cards

input()

A built-in Python function that pauses execution to capture user-provided data from standard input, always returning the value as a string.

4
New cards

print()

A built-in Python function that outputs and displays information, such as text, variables, and evaluated expressions, to the standard output.

5
New cards

Data Types

Classifications that define the type of value stored in a variable, enabling the interpreter to allocate memory efficiently and restrict operations to compatible actions.

6
New cards

Operators

Special symbols (such as +, -, *, /, and %) used in Python to perform mathematical, relational, logical, or bitwise operations on values and variables.

7
New cards

Operands

The values or variables on which an operator performs an operation.

8
New cards

If Statement

A conditional control flow statement used to execute a specific block of code only when a designated condition evaluates to True.

9
New cards

If-Else Statement

A conditional statement that executes one block of code when a condition evaluates to True and another block when the condition evaluates to False.

10
New cards

Elif Statement

A conditional statement used to test multiple conditions sequentially, executing its block when its condition evaluates to True after previous conditions evaluated to False.

11
New cards

For Loop

A loop control structure used to iterate over a sequence (such as a list, tuple, string, or range), executing a code block once for each item in the sequence.

12
New cards

While Loop

A loop control structure that repeatedly executes a block of code as long as a specified condition remains True.

13
New cards

Python Function

A reusable block of code defined with the def keyword that performs a specific task and promotes code reusability, modularity, readability, and maintainability.

14
New cards

String

An indexed sequence of characters enclosed within single or double quotes, where individual characters are treated as strings of length one.

15
New cards

Multi-line String

A string that spans across multiple lines while preserving newline characters, created using triple quotes (''' or """).

16
New cards

String Slicing

A method used to extract a portion of a string using the syntax string[start:end], where the start index is included and the end stopping index is excluded.

17
New cards

List

A built-in Python data structure used to store an ordered, mutable, and index-based collection of items that is dynamic and can hold multiple data types.

18
New cards

append()

A list method that adds a single element to the very end of an existing list.

19
New cards

insert()

A list method that adds an element at a specific index position, shifting existing elements to the right.

20
New cards

extend()

A list method that adds multiple elements from an iterable sequence to the end of the list.

21
New cards

remove()

A list method that deletes the first occurrence of a specified element from the list.

22
New cards

pop()

A method that removes and returns the element at a specified index in a list (or the last item if no index is provided).

23
New cards

Nested List

A list that contains one or more other lists as elements, commonly used to represent tabular data or matrices and accessed via chained indices.

24
New cards

Tuple

A built-in Python collection data type that is ordered and immutable (unchangeable), typically written with round brackets ().

25
New cards

Dictionary

A data structure that stores information in key-value pairs, where keys must be unique and immutable, while values can be of any data type.

26
New cards

get()

A dictionary method used to safely access a value linked to a specific key, returning None or a default value instead of raising a KeyError if the key is missing.

27
New cards

popitem()

A dictionary method that removes and returns the last inserted key-value pair as a tuple.

28
New cards

Set

A built-in Python data type that stores an unordered collection of unique elements, automatically eliminating duplicate entries and using internal hashing for fast lookups.

29
New cards

Frozenset

An immutable, hashable version of a Python set created using frozenset() whose elements cannot be modified, allowing it to be used as a dictionary key.

30
New cards

union()

A set method that combines elements from two sets and returns a new set containing all distinct elements from both.

31
New cards

intersection()

A set method that returns a new set containing only the elements common to both sets.

32
New cards

difference()

A set method that returns a new set containing elements present in the first set but absent from the second set.

33
New cards

strip()

A string method commonly used during file reading to remove leading and trailing whitespace, including newline characters.

34
New cards

readline()

A file handling method that reads a single line from an open file at a time, allowing efficient processing of large files without loading the whole file into memory.

35
New cards

CSV (Comma-Separated Values)

A standard plain-text file format used for storing tabular data, supported in Python via the built-in csv module for parsing rows and columns.