Python Programming: Python for Beginners: A Step-By-Step Guide on How to Program with Python by Mark Allen

Python Programming: Python for Beginners: A Step-By-Step Guide on How to Program with Python by Mark Allen

Author:Mark Allen [Allen, Mark]
Language: eng
Format: azw3, epub
Published: 2019-02-06T16:00:00+00:00


The parameter font had been given a default value, that is, TNR. In the last line of the above code, we have passed only two parameters to the function, that is, the values for width and height parameters. However, after calling the function, it returned the values for the three parameters. This means for a parameter with default, we don’t need to specify its value or even mention it when calling the function.

However, it’s still possible for you to specify the value for the parameter during function call. You can specify a different value to what had been specified as the default and you will get the new one as value of the parameter. Example:

#! usr bin/python3

def windowFunction(width,height,font='TNR'):

# printing everything

print(width,height,font)

windowFunction(245,278,'GEO')

The program outputs this:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.