Skip to main content

What is Python ?

What is python

What is Python: - Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Python was developed by
Guido Van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the
Netherlands.
Features of Python:-

Less line of codes than other languages (fast execution)

Platform independent
 Open Source
 Object Oriented
 It supports functional and structured programming methods
 It can be used as a scripting language or can be compiled to byte-code for building large applications
 It provides very high-level dynamic data types and supports dynamic type checking
 It supports automatic garbage collection
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java
How to start the Python? First of all install the Python 2.7.12 on your system. After installation it will create a directory in C: drive named Python27. In Python27
there is a file python.exe. Copy the path of python.exe from address bar.

To set the path of python in “path” system variable:-
1.
Copy the path of python.exe from address bar.
2.
Right click on Computer then click on Properties.
3.
Click on Advanced System Settings then click on Environment Variables.
4.
Choose path variable and click on Edit button.
5.
Deselect the path and stuff a semicolon at last and paste the copied path.
6.
Now click on OK button.
First Python Program:-
Open the command prompt, type python and press enter key.
The python prompt will open. Now type the following code:-
print “Hello Python!”
press enter key it will display following output:-


Hello Python!
Make simple calculator using python:-
On command prompt make a directory PythonProgs using md command.
Then use cd command to open PythonProgs directory.
Now type notepad SimpleCalc.py. The notepad editor will open and type the following code:-
a=input(“Enter first number : ”)
b=input(“Enter first number : ”)
print “Summation = ”,(a+b)
print “Subtraction = ”(a-b)
print “Multiplication = ”(a*b)
print “Division = ”,(a/b)
Now save the file SimpleCalc.py and close the file.
Now at command prompt type python SimpleCalc.py it display the following output:-
Enter first number : 10
Enter second number : 5
Summation = 15
Subtraction = 5
Multiplication = 50
Division = 2
Decision Making Statements:-
Use of if statement:-if is a keyword which is used for decision making. The syntax of if statement is given below:-
if condition:
Statement 1
Statement 2
Notes:-In Python there is no need to used curly braces { }. In python we use indentation to make code

Comments

Popular posts from this blog

Blogger Welcome to Education Blog Education is the act of learning things around us. It helps us to easily understand and deal with any problem and makes balance throughout the whole life in every aspect. Education is the first and foremost rights of every human being. Without education we are incomplete and our lives are useless. Education helps us to set a goal and go ahead by working on that throughout the life. It improves our knowledge, skill, confidence level and personality. It empowers us intellectually to interact with others in our life. Education brings maturity and teaches us to live in society with changing environment. It is the way to social development, economic growth and technological development.Education plays a great role in everyone’s life by building personality, improving knowledge and skill and providing feeling of well being of a person. Education has been divided into three categories in our country as Primary education, Secondary education and Highe...

Use of statement in python

Use of statement of Python: Use of if – else statement:-if – else is the variation of if statement. We attach condition with if statement if given condition is true then if block code will executed and if the given condition is false then else block code will executed. The syntax of if – else statement is given below:- if condition: Statement 1 Statement 2 else: Statement 3 Statement 4 Write a program in python to check the given number is even or odd. n=input(“Enter a number : ”) if n%2==0: print “The number ”,n,”is even” else: print “The number”,n,”is odd” Use of if-else ladder:- In Python language the switch statement is not worked. In Python we use if-else ladder in spite of using switch. The syntax of if-else ladder is given below:- if condition1: Statement 1 elif condition 2: Statement 2 elif condition 3: Statement 3 >br> else: Statement 4 Write a program in python to find greatest number in three numbers. a=input(“Enter firs...
Inspirational Quotes on Education School may have been – or may currently be – boring, a killer of creativity or downright awful for you. But education is still important because it opens the mind and expands it. And if your years in school were bad or boring you can still educate yourself now. So in this post I’d like to share 54 timeless, thought-provoking and inspiring quotes on education. “It is impossible for a man to learn what he thinks he already knows.”                         Mark Zuckerberg. In this success story, we are going to share Mark Zuckerberg biography, the youngest billionaire on the planet who created the Facebook social network that now has 1 billion monthly active users. Thanks to Facebook people around the world can easily keep in touch with all their friends. Not long ago, society just did not have such opportunity, but now...