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

history of computer.

History of Computer The ENIAC was invented by J. Presper Eckert and John Mauchly at the University of Pennsylvania and began construction in 1943 and was not completed until 1946. It occupied about 1,800 square feet and used about 18,000 vacuum tubes, weighing almost 50 tons. When was the first computer invented? There is no easy answer to this question due to the many different classifications of computers. The first mechanical computer, created by Charles Babbage in 1822, doesn't really resemble what most would consider a computer today. Therefore, this document has been created with a listing of each of the computer firsts, starting with the Difference Engine and leading up to the computers we use today. NOTE: Early inventions which helped lead up to the computer, such as the abacus, calculator, and tablet machines, are not accounted for in this document. First mechanical computer or automatic computing engine concept In 1822, Charles Babbage conceptualized and b

Classification of computer based on their cost size and confriguration.

<B><U> TYPES OF COMPUTER</B><U> Computer and it's Type Computers are classified by the type of data they are desinged to process. Data may be obtained either as a result of countig of through the use of same measuring instrument. Data that are obtained by counting are called discreate data are total numbers of students in a classroom. Data that must be obtained throgh measurement are called continous data. For example, continious data are the speeds an automobile measure by speedmotor or the tempreature of a patient as masured by a thermometer. Classification of computer based on their cost size and confriguration. In this category computers are classified