1. Dynamically Typed
- You don’t have to declare a type when declaring a variable.
- It skips headaches of type casting
JAVA:- int x = 1;
x = (int) x/2; x now equals 0
x can never be 0.5
Python:- x = 1
x = x/2 x now equal 0.5
2. Simple Syntax
- Some programming languages will kill you with parentheses, brackets, braces, commas and colons.
- With python you spend less time debugging syntax and more time programming
3. One liners
- Elegant 1 line solutions to what takes a whole block of code in other languages.
- Example- exchange value of x and y
JAVA:- int temp = x; Python:- x,y = y,x
x = y;
y = temp;
4. English-like Commands
- Python code is so much more readable than c, c++ and java code.
- Because python is design to be like english-like language
- Example- printing a name
JAVA:- string name = "Bob"; Python:- name = "bob"
system.out.println(name); print(name)
5. Intuitive data structures
- Lists, tuples, sets, dictionaries.
- Powerful, yet simple and intuitive to use.
- Flexible (mixed data types).