Defining a function in python

We should define a function when we need to do something repeatedly – something that can’t be done in a while loop or a for loop. Below is a sample function which prints a line on standard output. def print_something():    print(“Hi there”) print_something() Save the code in a file func.py and run as > python…

Read more...