Python Notes
Python Notes
010111 1001
1010101
Advantages – Faster,
Disadvantages – Processor, OS
8000 10
8001 20
8002 ?
Mov B, M
Inc M
Mov A, M
Add B
Inc M
Mov M, A
-ve – Processor, OS
High – Level
Extending, Embedding
Extensive Libraries
networking
$ 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
Natural (1 to infinity)
Whole (0 to infinity)
2 to 36 - Radix
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)