Return to site

Easy Python for beginner #3:

Basic syntax, "Hello World"

5-minutes reading

"Hello World" - print() function

In this tutorial, we will get to know some of the basic syntax of Python.

Now that you've got an idea of what a computer program looks like. We're going to use the Python interpreter to make our computer say hello to the world, by running this line of code in the code interpreter:

print("Hello World")

When we run this code, the words "Hello World" appear on the screen. It's because print( ) is a Python function that writes what we tell it to on the screen.

The print function is part of the basic Python syntax. Basic Python syntax consists of keywords and functions. Using the Python syntax is also equal to telling the computer what to do.

Whenever we use keywords or functions that are part of the language, we're using its syntax to tell the computer what to do.

So what are functions and keywords?

  • Functions are pieces of code that perform a unit of work. Some examples are: print(), type(), str(), etc. We will talk a lot more about functions later on, and you'll even learn how to write your own function. 
  • Keywords are reserved words that are used to construct instructions. These words are the core part of the language and can only be used in specific ways. Some examples: False, None, True, etc.

Last off, notice how "Hello World" is written between " " marks. Wrapping text in quotation marks (either double or single quotes) indicates that the text is considered a string, which means that text that will be manipulated by our script. String is one of the data type in Python, we will dig deeper into string and other data types in the next tutorials.

All right, now that we've written our first piece of Python code, I think you're ready for something a bit more challenging than "Hello World"

Up next, we'll dive deeper into some basic building blocks of Python syntax, things like variables, expressions, functions, and conditional blocks.

The tips to learn a programing language is to consider it as learning a spoken language.

Wow! That sounds like a lot to learn. But don’t worry. The tips to learn a programing language is to consider it as learning a spoken language.

For example, the best way to learn Spanish is to visit a Spanish speaking country, immerse yourself in the culture, listen to the people. Then figure out how to arrange the words to form a sentence that another speaker can understand. The same is true for programming. When you immerse yourself in Python programming you'll learn how to formulate statements of code that the computer can understand.

Again, if at any point you feel confused or that something just isn't clear, remember you can watch the tutorials over and over. And the most important thing is don't forget to utilize these exclusive supports (Eg. 1:1 Live QnA, Accountable Buddy Groups, etc) that can help your learning journey easier!

All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OK