More Functions

In the previous lecture you learned how to call the print function. Just like print there are a few other functions that Python makes readily available for programmers to use. Later you will also learn how to design your own custom functions so there will be no limits on what you can do with Python. For now, let us look at another ready-made function, the max function. We are calling the max function in line 10. 

The argument of the max function is the temperatures_celsius list. We will talk about lists later on. So, the argument of a function is not always text. It can be other types of objects as well. Even the argument of print is not text this time. The argument of print will be the output of max. So, print is designed to print out stuff in the output pane. max is designed to find out the maximum value out of a list of values. So, max finds the maximum value, and print prints it out. That's it. Let us move on to the next lecture to learn one more detail about functions. 

💡Tip: Note that the print function is one of the most used functions in Python. It has the power to print out content in the output pane. Other functions such as max can do other specialised operations, but they do not print their output. They are designed only to calculate their specific output. print is designed to print it out.

For example, if you execute the code below, nothing will happen. The output is calculated by max and stays in the Python interpreter memory during the execution time (a matter of milliseconds) but there is no function to print out the calculated value. Change line 2 to print(max(temperatures_celsius)) and run the code again to see the output printed out.


Next Lecture
Recommended Course

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.