Dictionary for Absolute Beginners#
Argument#
A value you pass to a function when you call it.
Example: In print("Hello")
, “Hello” is the argument.
Arithmetic#
Basic math operations you can perform on numbers.
Examples:
Addition
+
: 5 + 3 equals 8Subtraction
-
: 5 - 3 equals 2
Appending#
Appending refers to adding new elements to the end of an existing data structure, such as a list.
Example:
numbers = [1, 2, 3]
numbers.append(4)
Assignment#
Setting a value to a variable using the =
operator.
Example: x = 5
assigns the value 5 to the variable x.
Boolean#
Boolean is a data type that represents one of two possible values: True
or False
. Booleans are used to represent truth values in logic and are commonly used in conditional statements and control flow.
Comment#
Text in your code that Python ignores, used to explain the code so you know how to read it when you return to it.
Example:
# This is a comment
Concatenation#
The operation of joining or linking together multiple sequences to form a single sequence. The way concatenation is performed depends on the type of data structure you are working with.
For strings, concatenation is done using the +
operator, which combines two or more strings into one.
Example:
greeting = "Hello, "
name = "Alice"
message = greeting + name
Conditionals#
Conditionals are used to execute different blocks of code based on whether a condition is True
or False
.
Example:
age = 18
if age >= 18:
print("You are an adult.")
Data Type#
The kind of value that data can have in a programming language e.g., integer, string, float. The data type controls what kind of operations can be performed.
Example: 5
is an integer, "Alice"
is a string.
Documentation#
Documentation refers to written information that explains how to use, understand, or work with a particular piece of code. It can be within the code written by you (see Comment) or it can be offical documentation written by the provider e.g. the offical python documentation.
Float#
A float (short for “floating-point number”) is a type of number that can have a decimal point. It is used to represent real numbers that require precision beyond whole numbers, including fractions.
Example: 3.4
is a float
Function#
A function is a reusable block of code designed to perform a specific task. Functions can take inputs (known as parameters), process them, and return an output. Some functions are built-in already, while others can be defined by you.
Example: the built-in fuction max()
or print()
print(max(1, 2, 3))
IDE (Integrated Development Environment)#
A software application that provides tools for coding, like Jupyter Lab or the UCPH provided ERDA.
Immutable#
An object whose value or content cannot be changed after it has been created. Once an immutable object is initialized, any operation that seems to modify it will actually create a new object, leaving the original object unchanged.
Stands in opposition to Mutable.
An example is a string
.
Indentation#
Spaces (usually tab or four spaces) at the beginning of a line that define the structure of your code, especially in loops.
Example:
for something in something:
print(something)
Index#
A means to access specific elements by their position. An index indicates the position of an element within the sequence. Indexing typically starts at 0 for the first element.
Example:
"I am a string"[0]
"I"
Integer#
In Python, an integer is a type of number that represents whole numbers without any decimal points. Integers can be positive, negative, or zero.
Example: 5
and -12
are both integers.
Library#
A collection of pre-written code that provides useful functions and modules for performing common tasks, so you do not have to write the code from scratch.
Example: The Pandas library which is used in one of our more advanced courses.
Loop#
A structure which repeats a block of code multiple times until a certain condition is met. Like in the for
and while
loops.
Example:
for i in range(5):
print(i)
Mutable#
An object whose value or content can be changed after it is created. Mutable objects allow modifications, such as adding, removing, or altering elements, without needing to create a new object. lists
are mutable objects.
Stands in opposition to Immutable.
Operator#
A symbol that performs an operation on one or more operands.
Example: +
for addition, ==
for comparison.
Slice#
Slicing is a way to extract a part of a string by specifying where to start and stop. It lets you take a “slice” or a smaller piece of the string.
The first number of a slice is included, the last number of a slice is excluded.
Example:
"I am a string"[0:6]
I am a
Statement#
A statement is a single line of code that performs an action or a series of actions. Statements are the building blocks of a Python program and are executed in sequence.
String#
A data type which is surrounded by either single quotation marks, or double quotation marks.
Example: "Hello, world!"
Syntax#
The set of rules - the grammar if you like - that defines the combinations of symbols considered correctly structured by python logic.
Example: print("Hello")
is correct syntax; print(Hello)
is not.
Variable#
A name that stores a value. You can think about it as a small container in which you store a value.
Example: age = 25
assigns the value 25 to the variable age
.