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

January 6, 2016 | Views: 7236

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

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/LaeJhuDtKCU

2) 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/_PAIuw1b08E

3) 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 🙂

Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Ready to share your knowledge and expertise?
14 Comments
  1. hacking is possible by windows

  2. Nice and informative.

Page 2 of 2«12
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel