Python Terminologies Part — 2
Python has a rich set of terminologies that can be a bit overwhelming for beginners.
Here are some important terminologies in Python:
1. Argument — An argument is a value that is passed to a function or method when it is called.
For example:
def greet(name):
print("Hello, " + name + "!")
greet("John")Output:
Hello, John!
2. Operator — An operator is a symbol that represents a specific action. For example, the + operator performs addition, and the * operator performs multiplication.
3. String — A string is a sequence of characters. You can define a string using either single quotes or double quotes.
For example:
x = "Hello, World!"
y = 'Python is awesome'4. List — A list is a collection of items that are ordered and changeable. You can define a list using square brackets.
For example:
fruits = ["apple", "banana", "cherry"]
print(fruits)Output:
[‘apple’, ‘banana’, ‘cherry’]
5. Dictionary — A dictionary is a collection of key-value pairs that are unordered and changeable. You can define a dictionary using curly braces.
For example:
person = {"name": "John", "age": 30, "country": "USA"}
print(person)Output:
{‘name’: ‘John’, ‘age’: 30, ‘country’: ‘USA’}
Get Rinu Gour’s stories in your inbox
Join Medium for free to get updates from this writer.
6. Tuple — A tuple is a collection of items that are ordered and unchangeable. You can define a tuple using parentheses.
For example:
fruits = ("apple", "banana", "cherry")
print(fruits)Output:
(‘apple’, ‘banana’, ‘cherry’)
7. Set — A set is a collection of unique items that are unordered and unindexed. You can define a set using curly braces.
For example:
fruits = {"apple", "banana", "cherry"}
print(fruits)Output:
{‘apple’, ‘banana’, ‘cherry’}
8. Module — A module is a file containing Python code that defines functions, classes, and variables. You can use modules to organize your code into reusable blocks.
9. Package — A package is a collection of related modules. You can use packages to organize your code into logical groups.
10. Exception — An exception is an error that occurs during program execution. In Python, you can use try-except blocks to handle exceptions and prevent your program from crashing.
For example:
try:
x = 5 / 0
except ZeroDivisionError:
print("Cannot divide by zero")Output:
Cannot divide by zero
Conclusion
In conclusion, Python has many terminologies that are important to understand.
The above guide covers some of the most important terms in Python, along with examples to help you better understand how they work.
As you continue to learn Python, you’ll encounter many more terminologies that will become second nature over time.
It’s important to keep practicing with these terms and to also explore new ones as you continue to grow your knowledge of Python.









