Python Glossary
A programming glossary for Python for the beginner. If you want a more in-depth glossary, visit the Official Python Documentation.
Class
Python is a Language that supports the Object Oriented Programming paradigm. Like other OOP languages, Python has classes which are defined wireframes of objects. Python supports class inheritance. A class may have many subclasses but may only inherit directly from one superclass.
Syntax
Example
Comments
SINGLE-LINE COMMENTS
MULTI-LINE COMMENTS
Dictionaries
Syntax
Example
Syntax
Example
Functions
Syntax
Example
Syntax
Example
Function Objects
Example
len()
Syntax
Example
List Comprehensions
Syntax
Example
Lists
Example
Loops
FOR LOOPS
Example
WHILE LOOPS
Example
print()
Example
range()
Syntax
Example
Sets
Example
Slice
Example
str()
Example
Strings
Example
Tuples
Example
TUPLE ASSIGNMENT
Example
Variables
Example
Python Glossary
1. Python
Python is a high-level, interpreted programming language known for its simplicity and readability.
print("Hello, world!")
2. Variable
A variable is a name that refers to a value stored in memory.
x = 5
3. String
A string is a sequence of characters enclosed in single or double quotes.
message = "Hello, world!"
4. Integer
An integer is a whole number without a decimal point.
age = 30
5. Float
A float is a number with a decimal point.
pi = 3.14
6. List
A list is a collection of items, which can be of different types, enclosed in square brackets and separated by commas.
numbers = [1, 2, 3, 4, 5]
7. Tuple
A tuple is an immutable collection of items, enclosed in parentheses and separated by commas.
coordinates = (10, 20)
8. Dictionary
A dictionary is a collection of key-value pairs, enclosed in curly braces and separated by commas.
person =
9. Function
A function is a block of reusable code that performs a specific task.
def greet(name):
print("Hello, " + name + "!")
10. Module
A module is a file containing Python code that can be imported and used in other Python programs.
import math
11. Loop
A loop is a control structure that repeats a block of code multiple times.
for i in range(5):
print(i)
12. Conditional Statement
A conditional statement is a control structure that executes different code blocks based on whether a condition is true or false.
if x > 0:
print("Positive")
else:
print("Negative")
13. Class
A class is a blueprint for creating objects that have similar attributes and methods.
class Car:
def __init__(self, make, model):
self.make = make
self.model = model
14. Object
An object is an instance of a class.
car = Car("Toyota", "Camry")
15. Exception
An exception is an error that occurs during the execution of a program.
try:
result = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero")
16. Method
A method is a function that belongs to an object.
class Dog:
def bark(self):
print("Woof!")
17. Attribute
An attribute is a value associated with an object.
dog = Dog()
dog.breed = "Labrador"