Basic Concepts:
Our first Program in Python:
Let’s Start making our first program in Python. We will write a program that prints “Hello World" on the screen So let’s get in and write our first Python program. You can use any IDE for python for offline work. I suggest the ‘Anaconda’ python interpreter. And for online I suggest Replit (https://replit.com) so just go to this website and create your first program. Without taking any longer Let’s get started..
Output: Hello World !
So as you can see it is so simple and it will print Whatever you write in between these double quotations , you can also use single quotations. It doesn’t matter if it will work the same. Let’s do something more,
Output: Hello World
I am Covid-19
It will print these two statements on different lines and it will automatically generate a new line.
What if you want to print two or more lines in one print function (We will cover functions later)?
So here is the answer: just put ‘\n’ where you want to break the line. Let's code it.
Output: Hello World!
I Love Python
And what if you want to print double quotation (“”) or single (‘’) on your screen?
You can print it just by adding a backslash (\) before it let’s see how it works
Output: I’m Covid, I’m here to teach you Python
The interpreter will not print the backslash.
So, there is a task for use guys.
you have to make this triangle correct output should be like this.
*
**
***
****
Key point:
Anything written in these double quotations is known as strings we will cover it in coming tutorials.
Our first Program in Python:
Let’s Start making our first program in Python. We will write a program that prints “Hello World" on the screen So let’s get in and write our first Python program. You can use any IDE for python for offline work. I suggest the ‘Anaconda’ python interpreter. And for online I suggest Replit (https://replit.com) so just go to this website and create your first program. Without taking any longer Let’s get started..
Code:
print(“Hello World !”)
Output: Hello World !
So as you can see it is so simple and it will print Whatever you write in between these double quotations , you can also use single quotations. It doesn’t matter if it will work the same. Let’s do something more,
Code:
print(“Hello World!”)
print (“I am Covid-19”)
Output: Hello World
I am Covid-19
It will print these two statements on different lines and it will automatically generate a new line.
What if you want to print two or more lines in one print function (We will cover functions later)?
So here is the answer: just put ‘\n’ where you want to break the line. Let's code it.
Code:
print(“Hello World!\nI love Python”)
Output: Hello World!
I Love Python
And what if you want to print double quotation (“”) or single (‘’) on your screen?
You can print it just by adding a backslash (\) before it let’s see how it works
Code:
print(“I\’m Covid, I\’m here to teach you Python”)
Output: I’m Covid, I’m here to teach you Python
The interpreter will not print the backslash.
So, there is a task for use guys.
Code:
print("* ** *** ****")
you have to make this triangle correct output should be like this.
*
**
***
****
Key point:
Anything written in these double quotations is known as strings we will cover it in coming tutorials.
In the next post we will cover some basic operations...
("Allah Hafiz" and "Good Bye" Till the next post )
"Keep Learning and Keep exploring"
Love me like you do