What is python and python basic coding and create a calculator using python ?
Hello Friends In this Blog I will teach you What is python and python basic coding then please read the blog full If you want to learn python and create your First program.
What is Python and Python Programming Language?
Python is a high level programming Language which is so simple and easy to learn and even a teenager can also learn this language.
But Why Python ?
Python is so simple than other Programming Language like Java , C++ , C etc
and Python is also used in Websites and Machine Learning. It means that you can create websites through python. And also Google also use python.
What is Programming Language ?
If you are beginner and don't know Programming then Programming is a way to communicate with computer. For example We talk to each other with a language but in computer case we have to talk with computer using Programming.
Here Talking is means to do calculation and other computation work.
Python Basic and Installation ?
To use Python You have to first Install Python from python official website
and If you are on Linux then download for Linux But If you are on windows then
Download and Install for windows.(download The latest version of the python)
And Then open python Idle It will look like this ?
Here you can write any python code and then write here print("Hello world")
Then It will display 'Hello world' .
and If you are on Linux then download for Linux But If you are on windows then
Download and Install for windows.(download The latest version of the python)
And Then open python Idle It will look like this ?
Here you can write any python code and then write here print("Hello world")
Then It will display 'Hello world' .
How to create a Calculator using python ?
First Click On File and then Click New File and then save it as main.py .
And then write code.
Do not worry code is here.
a = 2
b = 5
print(a + b)
And then close the file and run the file main.py and then It will display 7.
If you Change a = 12 and b = 16 and then save the file and then you run main.py then it will display 28 .
Here a and b is a variable that stores 12 and 16 and second code print(a + b)
It means to sum a and b.
I think you can understand the python coding. Here you see that python is so simple.
what happen if you change print(a + b) into print(a * b)
Then it will multiply the a and b.
similarly you can also divide and subtract like this print(a / b) and print(a - b)
What can you store in variable and what is data type ?
Here we create some variables name a and b which stores 12 and 18.
But you can also store some text in variables like this
text = "Hello world"
and then if you print(text)
then it will display Hello world
If you want to store a text then you have add " after text and before text then it will consider as text.
Data Type ?
Data Type | Name in simple way | Example |
---|---|---|
String | Int | Float |
text | Numbers | Decimals Numbers |
"Text" | 156 | 1.25 |
By seeing the table I think you know that what is data types.
If you read my blog full then thanks for reading
No comments:
Post a Comment