0% found this document useful (0 votes)
22 views

Python Notes

Uploaded by

Pradeep Darade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Python Notes

Uploaded by

Pradeep Darade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Session 1 (20-Sep-20)

Binary or Low Level

010111 1001

1010101

Advantages – Faster,

Disadvantages – Processor, OS

Middle Level or Assembly

8000 10

8001 20

8002 ?

Lxi HL, 8000

Mov B, M

Inc M

Mov A, M

Add B

Inc M

Mov M, A

+ve – Equally faster

-ve – Processor, OS

High – Level

Fortran, Pascal, Basic, Shell, C, C++, Java, C#, Python, Perl,

Extending, Embedding

Extensive Libraries

Numpy, scipy, matplotlib,

networking

Compiler – Translation of HL language code to machine level language (whole file)

Execution – Loading program to RAM

Interpreter – In built compilation and execution (line by line)

$ gcc helloworld.c
$ ./a.out

$ javac helloworld.java

$ java helloworld

$ cat helloworld.py
#!/usr/bin/python3
print ("Hello World! Welcome to Python!")
print ("Sum of 10 + 20 is ", 10 + 20)
$ chmod u+x helloworld.py
$ ./helloworld.py

$ #or
$ python3 helloworld.py
$ cat helloworld.c
#include<stdio.h>
int main()
{
printf("Hello World\n");
printf("Sum of 10 + 20 is %d\n", 10 + 20);
return 0;
}
$ gcc helloworld.c #Generates a.out if no errors
$ ./a.out
$ cat HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World\n");
return;
}
}
$ javac HelloWorld.java
$ java HelloWorld

Python

1. Interactive Mode
2. Execution Mode
3. IDE (Integrated Development Environment)

IDLE

Identifiers or variable

1. Alphabet or numeric or _
2. Start with alphabet or _
Keywords

Data Types

1. Numbers (integers, floats, complex numbers)


2. Strings (“hello”, “python”, ‘world’, ”””My world”””)
3. Lists
4. Tuples
5. Dictionary
6. Sets

Natural (1 to infinity)
Whole (0 to infinity)

Integers (-infinity to 0 to infinity) – Radix 10

2 to 36 - Radix

Octal, Decimal, Hexa Decimal

12

Decimal (0 to 9)

Octal (0 to 7)

Hexa (0 to 9, A, B, C, D, E, F)

Conversions

Binary to Decimal (* 2)

Decimal to Binary (/ 2)

Octal to Decimal (* 8)

Decimal to Octal (/ 8)

Hexa Decimal to Decimal (* 16)

Decimal to Hexa Decimal (/ 16)

You might also like