You are on page 1of 5

Agenda

What is Python?

Why u need python?

What is its structure?

How memory management?

Python?

Is a programming language.

C…….. Structure

C++…….. Object oriented

Java…….. procedure oriented

Python……………..Scripting Language….. story….

Structure….

Add of 2 numbers?

a=?

b=?

c=a+b

Python is a scripting language

It is very easy because it doesn’t follow any proper syntax.

Advantages of Python:
Time consumption(less)

no wastage of memory

low power utilisation

Time consumption:

a=10

Fetch………….a=10

Decode…….(2 parts)………(address & data)…………(a&10)

Execute……….it will perform the task(=)……………..a(10)

R/w:printing the content……..Read & saving……..write

10ms….. time required inorder to finish the execution of statement.

Time utilisation = No of Statements

Architecture of Python:

RISC(Reduced Instruction Set Computing).

In general we have 2 architectures.

CISC…. Complex Instruction Set Computing

RISC.

Example:

Swap 2 numbers(a=10, b=20)…. Inputs & output=(a=20,b=10).

CISC.

T=0
T=a

a=b

b=T

Output:

a=20,b=10……(40 ms)

RISC

a,b = b,a

Output:

a=20,b=10…….(10 ms)

No wastage of Memory

Example:

wap to print ‘Hii’?

CISC(c):

#include<stdio.h> Header Files(printf, scanf, other libraries )

Void main()

printf(“Hii”);

}….. 1 kb………..102kb……….102kb

Total No of Lines: 10004

Python:

print(‘Hi’)….. 1kb
Low Power Utilisation:

power directly proportional to time.

Structure Of Python

Syn:

variable……….. used to store the input or output data

statements……. Inorder to execute the task.

Memory Management:

Structure of other program languages

Header files

Global variables;

Global Statements;

Main function

local variables;

local statements;

Code Segment:

all the local variables & local Statements


Data Segment:

all the global variables & global statements

Stack:

at the time of function execution

Heap:

Data allocation: 2 types

1. Static data allocation

Ex: a = 10

2. Dynamic data allocation

Ex: b = ?

Heap is mainly for dynamic memory allocation(Infinite memory block)

You might also like