Python is an open source programming language and it is among the top five most popular languages in the world. It is a good programming language for beginners. Writing programs in Python takes less time than in some other languages like C, C++, Java. Latest version of python is python3.
Python is not only used for general problem solving but also for the development of high-level applications like -
-
Web Development: Can perform server side programming through Python libraries like Django and Flask.
-
Prototyping: Can create quick prototypes to present the client.
-
Game Development: Used in the development of games through libraries like PyGame.
-
Data Science and Machine Learning: It has a great community and a vast range of libraries.
-
😃 Easy to read and learn: The syntax is very simple and straightforward.
-
👌 Speedy: Execution of the code is very fast.
-
⚡ Extensible: Python can be extended to other languages.
-
😍 Free and Open-Source: It is freely available, can download its source code, make changes to it, and even distribute it.
-
😮 Interpreted: Python directly executes the code line by line and not need to be compiled to run.
-
💥 Protection: It avoids the harm from software bugs.
-
Open the Python Website in your browser.
-
In the Downloads tab choose the latest version of Python(Python 3.8.5) and click on it to download.
-
An Executable file will be downloaded.
-
After the completion of download, run the Python Installer.
-
Select the check box containing the Install launcher for all users.
-
Click on Customize Installation.
-
Select the check boxes contaning Documentaion, pip, tcl/tk and IDLE, Python test suit, py launcher for all users.
-
Click on next button.
-
This takes you to Advanced Options.
-
Here, select the check boxes containg Install for all users and Add Python to environment variables.
-
Click on Install button to start installation.
-
Once the installation is over, you will see a Python Setup Successful window.
-
In the start menu, search for View advanced system settings and open it.
-
In the System Properties window, click on the Advanced tab and then click on the Environment Variables button.
-
In the System Variables window, select the Path variable.
-
Click on NEW and name the variable as PATH and variable value as the path C:\Program Files (x86)\Python38-32;C:\Program Files (x86)\Python38-32\Lib\site-packages;C:\Program Files (x86)\Python38-32\Scripts.
-
Click OK.
-
In the start menu, search for Command Prompt and open it.
-
After opening, to check the installation, type python or python-version or python -V in command prompt.
-
You can see the python version you have installed.
-
Another alternative is you can search for IDLE(Python version) in the start menu.
-
A python shell will be opened where you can work on python.
The print function in Python is a function that outputs to your console window whatever you say you want to print out.
For Strings : print("string or any sentence")
For Numbers : print(number)
For Operations with numbers : print(number1 operation number2)
Input:
print("Hello World")
print("welcome to python3")
print(3)
print(5+4)
print(6-2)
print(4/2)
Output:
Hello World
welcome to python3
3
9
4
2.0
In python there is no need to declare the datatype(string,integer,....) of the varaiables before initialization.
For Strings : variable = "string or a sentence"
For Integers : variable = number
For Operations with integers : variable = number1 operation number2
variable = variable1 operation variable2
Input:
a = "What is your name?"
print(a)
b = 7
print(b)
c = 3
print(c)
d = b + c
print(d)
Output:
Here, a = "What is your name?", so by the statement print(a) the output is
What is your name?
Here, b = 7, so by the statement print(b) the output is
7
Here, c = 3, so by the statement print(c) the output is
3
Here, d = b + c , so d = 7 + 3 = 10, so by the statement print(d) the output is
10
In python In python there is no need to declare the datatype(string,integer,....) of the varaiables before taking the input.
For Strings : variable = input()
For Integers : variable = int(input())
For Float : variable = float(input())
Input:
x = input()
print(x)
y = int(input())
print(y)
z = float(input())
print(z)
Output:
Here, by taking input as x = "Hello", so by the statement print(x) the output is
Hello
Here, by taking input as y = 8, so by the statement print(y) the output is
8
Here, by taking input as z = 10.63, so by the statement print(z) the output is
10.63
Comments are used to explain what the code does in each line. Python will ignore the Comments.
Single line comment : We use '#' ( #comment )
Multi line comments :
#comment1
#comment2
.
.
.
or
We can use Multi line string : we represent by
"""
comment1
comment2
.
.
.
"""
To get the Python Tutorial click here
Thanks for Reading!!!
Regards
CHAITHANYA