Python Code :
def printMessage( ):
print("The Quick Brown Fox Jumps Over The Lazy Dog!")
if_name_=="_main_":
printMessage( )
Let us look at the program line by line to understand what it is doing.
Python Code :
def printMessage( ):
print("The Quick Brown Fox Jumps Over The Lazy Dog!")
The above line is a function in Python.The function is printing a message to the screen.
Python Code :
if_name_=="_name_":
The above line checks if the module is running as main.
When python runs the module, it sets _name_variable to the value_main_.
Main check is the entry point for a Python Program.
Python Code:
printMessage( )
The above line is a function call in Python.
The function call printMessage was defined above.
We can call function defined in other modules by importing them.We can use import keyword to import other functions.Similarly other modules can import printMessage function by importing from our file.
We can save the file to a favorite location.
Name the file: HelloWorld.py. We can run the file using the following command .
Command:
python HelloWorld.py
Output:
The Quick Brown Fox Jumps Over The Lazy Dog!