Python Hello, World
Writing the “Hello, World!” Program
print("Hello, World!")
Let’s break down the different components of the code.
print() is a function that tells the computer to perform an action. We know it is a function because it uses parentheses. print() tells Python to display or output whatever we put in the parentheses. By default, this will output to the current terminal window.
Some functions, like the print() function, are built-in functions included in Python by default. These built-in functions are always available for us to use in programs that we create. We can also define our own functions that we construct ourselves through other elements.
Inside the parentheses of the print() function is a sequence of characters — Hello, World! — that is enclosed in quotation marks. Any characters that are inside of quotation marks are called a string.
Once we are done writing our program, save the file and we can exit notepad.
Once you exit out of notpad you’ll return to your shell or cmd.
Running the “Hello, World!” Program
The hello.py program that you just created will cause your terminal to produce the following output:
Hello, World!
No comments:
Post a Comment