Beginner Python Tutorial Series: Chapter 2 - Basics
Beginner Python Tutorial Series
Chapter 2 - Basics
Hello, and welcome to part two of my Beginner Python Tutorial Series!
Today, I will be going over two of the most simple and useful parts of Python!
With every step, read the info, then try it out on a seperate Python tab (just use Replit).
So...let's get started, shall we?
The print function is used to display a message to the console.
To use this function, type this into the code window:
You should get this result:
Well done! You just used print ("") for the first time!
Another really useful one is the input function. This does use variables, which I will be explaining in the next tutorial. For now, just do as I do.
To use input, we set a variable to the user's input. It is used like this:
Where I have written 'name', you could choose anything, as long as it follows the rules of variables, which I will go over in the next tutorial.
But if you try and do this yourself, nothing will happen after you enter your name.
Let's use our new skills we have learned today to make a very simple program.
First, we will ask for the user's name.
Now, we will print a message.
Cool, but it could be better. Why don't we refer to their name? After all, we have stored it in the 'name' variable!
So, that just about wraps up this tutorial. Look out for part 3, coming soon!
Have a good day and keep coding,