# Functions in Python

Published 2022-12-03

This tutorial give you some example of using defined functions in Python.

Defining and using functions in Python is very easy. Here is an example:

def charCount(string1 = "Test"):
   count1 = 0
   for i in string1:
      count1 = count1 + 1;
   return count1;
var1 = charCount('How are you ?')
var1 = charCount()

And here you can see the execution of the Python code in PyCharm:

This code define a function named "charCount". This function could be called with or without parameters. If no parameter is passed to the function call, Python will use the default value.