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

Classification of computer based on their cost size and confriguration.

TYPES OF COMPUTER 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 as micro-computer. mainfraim compute...

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...

computer and it's generation

Computer and It's GENERATION Let us first define the term computer. Computer is defined in the Oxford dictionary as "An automatic electronic apparatus for making calculations or controlling operations that are expressible in numerical or logical terms." The definition clearly categorise computer as electronic apparatus although the first computers were mechanical and electromechanical apparatus. The definition is also pointing towords the two major areas of computer application viz. data processing and computer assisted controls/operations. The another important confluence of the definition is the fact that the computer can perform only those operations/calculations which can be expressed in logical or numerical terms. Computer Generation From the early 1940's to the present, Computer scientists have been able to identify clear-cut stages in the development of computer technology. With each stage, radical change in electronics have taken place. As a resu...