Python is a flexible programming language used for several applications, from machine learning to AI, we can also use this language to build software applications using popular frameworks such as Django and Flask.
In this first section, we will learn how to write to the console “Hello world!”. We’ll also keep things simple, we’ll be using a website called repl to run our Python code without the worry of system configurations:
Head over to repl and start your free account now: https://repl.it/
Once you’ve completed your sign up hit the “New repl” button on the top right-hand corner of the web page, once completed you should fill out the dialogue box by Selecting Python in the language Field and naming the repl a name of your choosing. Next lets add this line of code to the
#This is a comment print("Hello World!")
Hit the run button and see what the console returns!
> Hello World!
Now let’s elaborate a little more on this. The
print function outputs whatever is in the quotations to your console. the line
#This is a comment is a line in python providing developers with information that won’t be interpreted with the actual python program.
Let’s practice introducing ourselves in python. Change the Code in the Main.py file to match the following below and replace the comment
#YourName with your real name:
name = #Yourname print("Hello, My name is ", name)
If I replace the
#yourname comment with
"Adam" this is what the output would give me:
> Hello, My name is Adam.
That should be a wrap for this first section, let’s later move on to the next section where we’ll use python to calculate the product and difference of two numbers!