Python function name convention is to use a lowercase word or words. Separate words by underscores to improve readability.
function
#OR
my_function
For example, if you have a function that calculates the sum of two numbers, you could name it calculate_sum
or sum_numbers
.
Python function name convention examples
A simple example code function takes two numbers as input and returns their sum.
def calculate_sum(num1, num2):
return num1 + num2
print(calculate_sum(500, 499))
Output:
![Python function name convention](https://i0.wp.com/tutorial.eyehunts.com/wp-content/uploads/2023/03/Python-function-name-convention.jpg?resize=258%2C125&ssl=1)
Comment if you have any doubts or suggestions on this Python name convention topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.