Python Programming for Hackers (Part 2) - All About Variables and Arithmetic Expressions
By: bjacharya
January 6, 2016

# Python Programming for Hackers (Part 2) - All About Variables and Arithmetic Expressions

By: bjacharya
January 6, 2016
By: bjacharya
January 6, 2016
Welcome again to Python Programming for Hackers. This is Part 2. In this part, we'll see some information on Python 2 and Python 3. We'll see video links on printing "Hello World," Arithmetic Expressions and Variables in Python.
• There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 2, because it's more widely used and supported. However, Python 3 is more semantically correct, and supports newer features. As I said, this tutorial uses Python 2, but in some cases we'll work with Python 3.
• One difference between Python 2 and 3 is the "print" statement. In Python 2, the "print" statement is not a function, and therefore it's invoked without parentheses. However, in Python 3, it's a function, and must be invoked with parentheses.
Let's take a look:1) Printing Hello World - You'll get the chance to learn about how to print 'Hello World' in Python Shell, which is presented in video below. The lab involves Kali Linux Python Shell. Video link: http://youtu.be/LaeJhuDtKCU2) Arithmetic Expressions - Numbers, Operators and Expressions will be explained in the video below.# Numbers – 2 types – Integers (1,3,-6…) & Decimals (1.0,2.3,-7.2…) # Datatype for integer is int() & for decimal is float() . . .Video link: http://youtu.be/_PAIuw1b08E3) Variables - A Variable is a placeholder for storing values.

- Once we store values in variable, it helps in avoiding recomputing of same values.- Assigning variables also helps reader to understand codes.- Valid variable name consist of: letters, numbers, underscore- Starts with letter or underscore- Legal names : hacker, Ethical, h_a_c_k- Illegal names: 333hacking, 1234- While assigning value to variable, we use equal to (=) sign.- Remember, double (= =) equal to sign is used to test equality.

Video link: http://youtu.be/7RTDk9d15a8 I hope you enjoy the training videos. Thanks for reading and watching :)