Python is a cool language for hackers. However, instead of treating it like C for hacking at the low level like overflows and stuff, its much more efficient if we use it for automation, scraping and high level stuff as it is a high level language!
Syntax and Indentation: The syntax & design of python is indentation based, unlike C and some other languages which dont care about the indentation.
Control Flow: Control flow of python consists of if/elif/else for conditionals, and/or/not for logical operators and while/for/in for loops.
Data Structures: The different data types in python are:
- Lists - dynamic arrays, in square brackets [].
- Tuples - unchangable lists, in brackets ().
- Dictionaries - Key-value pairs, in curly brackets {}.
- Sets - unordered collection of unique items, also represented with {} but without “key: value” pairs.
Functions: Functions can be defined using the built in def function, short for define.
Error Handling: Python offers built in functionality for handling errors instead of making it necessary for the program to crash, using the try and instead blocks.
Command Line Arguments: Can be used by importing a library called sys.
File I/O: Using the with keyword to easily and automatically handle the closing of files.
Python is itself written in C!