Python lectures Flashcards
Python
a high-level programming language that runs on top of your operating system. it is object-oriented and very portable since it can run on every machine. it is also very extensible since you can add extensions and libraries.
Pandas
the visualisation component/extension that allows you to draw figures.
Jupyter
allows you to save intermediate results, which is not possible in traditional programming. this is important because the process of analysing data is important for data management.
code/source code
the sequence of instructions in a program.
syntax
the set of legal structures and commands that can be used in a particular programming language. It’s like the grammar of a language, but for computers.
output
the process of displaying, writing, or communicating text, values, or other information to the user, the computer hard drive, or to a network of other computers or users.
console
the text box onto which output is printed.
functions
a subroutine or method. It is a self-contained block of code that performs a specific task. It’s like a mini-program within your larger program, designed to handle a well-defined job. The key purpose of functions are to modularise code: Functions break down complex programs into smaller, manageable chunks, making code easier to understand, organize, and maintain. Other reasons for using function is to reuse code or to simplify complex tasks.
parameter
a formal argument and acts like a placehold variable within a function or method. it holds specific data that is provided when the function is called. its purpose is to allow functions to be flexible and reusable. functions can have multiple parameters. they accept different data inputs each time they are called.
variable modification
when a variable already exists, but gets a new value assigned.
variable data types
define the kind of information a variable can hold and the operations that can be perfomed on it. it ensures data integrity, optimises memory usage, and enables specific operations.
type() function
tells you the data type of a variable.
type conversion
refers to the process of changing the data type of a variable from one data type to another. not every type can be converted, eg. a string.
input () function
used to collect data from the user during program execution. It pauses the program, reads or prompts the user for input, and then stores the entered value as a string so it can be used within the program.
operators
special symbols or keywords that perform specific operations on values and variables. They are the building blocks of expressions and play a crucial role in manipulating data, making comparisons, and controlling program flow.
screen
refers to the terminal window where the program is running, eg. colab boxes. this is where output is displayed.
if/else statement
used to control the flow of execution in your code based on specific conditions. It allows you to execute different sets of code depending on whether a condition is true or false.
condition
an expression that evaluates to either True or False. Conditions can be the state of a variable, or, for example, the result of a comparison of values, the result of a function call, the result of a membership test, or a combination of multiple conditions (through logical operators).
comparison operators
symbols used to compare the values of two operands (data elements) and return boolean values (True or False) indicating the relationship between them. These operators are essential for conditional statements (if, else), loops (while, for), and various control flow structures.
text comparisons
are case sensitive. each character gets a numerical value that is compared based on the order of characters.
control flow
refers to the order in which your code executes. it determines which lines of code get run and when, allowing you to create logic in your programs.
indentation
should only happen when there is a need for a separate block; after if, for, while, defining a function, or a class.
list
ordered, mutable collections of elements enclosed in square brackets []. it is a variable that contains multiple values.
elements
the values in a list, which are stored at an index.
for loop
a powerful tool for iterating over sequences of elements. It allows you to execute a block of code repeatedly for each item in the sequence, making it an efficient way to automate tasks and process collections of data.
while loop
a control flow structure that allows you to repeatedly execute a block of code as long as a specified condition remains true. It provides flexibility for situations where the number of iterations is unknown beforehand or depends on a dynamic condition.