Skip to main content

Introduction to Python


Python is a high level, object oriented programming language. It has simple and easy to learn syntax. It is good for beginners as well as for developers. Python is used in various fields now with its growth in popularity as compared to other Programming languages like Java, C, PHP, etc. Python was developed by Guido Van Rossum in February 1991. Python was supposed to be a successor of the ABC language.

Python Logo Sketch freebie - Download free resource for Sketch ...

Python programming language was named after the famous BBC Comedy show, Monty Python's Flying Circus.


 Advantages of Python

• Python has very easy to learn syntax. Thus it is programmer friendly.

• Python is an interpreted language. It means that it executes the code line by line at a time.

• Python runs on almost all platforms like Windows, Linux, Android, Mac, etc.

• Python is freely available online at www.python.org.

• Python comes with additional libraries and built-in functions.

• It is used for scripting, web applications using django, game development using panda, Database applications, etc.

• Python is more expressive than other Programming languages as it does the same work in lesser code.


 Disadvantages of Python

• Python comes with many libraries but it doesn't have more libraries than Java, C, Perl, etc.

• It is difficult to convert or translate python programs into another programming languages.

• Python is unable to catch

'Type-mismatch' issues. For example: When you store an number in a variable and later store string in the same variable then python didn't raise any error.

• Since python is an interpreted language it takes much time in the execution process.


 Interpreter vs Complier

Interpreter: It converts the high level language into machine language line by line at a time. It displays the error at the same time and doesn't proceed unless the error is corrected.


Compiler: It converts the high level language into machine language in one go. It displays errors with its line number at the end of the program.

You can work in python in two modes:

✓Interactive Mode

✓Script Mode

Interactive Mode:

In python Shell, instructions are given in front of Python prompt ( >>> ) and gives output after each line.

Script Mode:

In Python Script, programs are saved with .py extension and gives whole output in one go.


 Program to print text on screen

Input code:

print("Hi!!")
print("How are you ?")


Output code:

Hi!!
How are you ?


Comments

Post a Comment

Popular posts from this blog

Programming Questions

Programming Questions with source code Program 1: Program to obtain side of a square and then calculate its area.   Input code:  a=int(input("Enter the side of square:")) sq=a**2 print("Area of square is :",sq) Program 2: Program to obtain length and breadth of a rectangle and calculate its area. Input Code:   l=int(input("Enter length of the rectangle:")) b=int(input ("Enter breadth of the rectangle:")) area=l*b print("Area of rectangle is:",area) Program 3: Program to obtain height and base of a triangle and calculate its area.   Input Code: l=int(input("Enter length of triangle")) b=int(input("Enter base of triangle")) area=0.5*b*h print("Area of triangle is:",area) Program 4: Program to obtain a number and print its square and cube. Input Code:   num=float(input("Enter the number:")) sq=num*num cube=num*num*num print("Square of",num,"is",sq) print("Cube of",num,&q

Variables & Type of Literals and Operators

Variables in Python Variables are the character(s) used to store a value to be used further in the program. For example, when you want to store roll number of a student in the program then we use some variables to store roll number data:                      Roll_no = 35 In the above statement we use an identifier(Roll_no) to store roll number of a student of integer type. Then we can call Roll_no a numeric variable.                      Em_name = “Sanu” Then we can call Em_name a string variable.   IMPORTANT: In Python, you cannot use integer, float, complex number, expression as a variable as it will raise an error. You can only use characters, or identifiers to store any value. For example: 36=Id 25=x 2a/c=20     In Python, you can use multiple assignments.  #that’s nice For example: A,B,C=5,10,15 x=y=z=50   Dynamic Typing A variable who is used to store a value of one type, can be used again to store a value of different type. Python uses D