Learning Python by doing #1. Introduction the basic

Assalamualaikum,
here we go, lets start with the definition of python. python is  a programming language that lets you work more quickly and integrate your systems more effectively. then what the beneficials of using python ?

Python strengths:

  • Great documentation and community
  • Very clean syntax
  • Readable code
  • Open source
  • Portable : Windows, Linux, Mac OS
  • Interactive : built-in interpreter
  • Code can be grouped in modules and packages
  • OOP ( Object-oriented programming

Python is used for :

  • Web development
  • Network applications
  • Scripting
  • Software testing
  • GUI development
  • Scientific applications
  • etc

oke lest make a good environtment, in this case i used kali linux for testing my python script if u have some another option linux distro u can use that, go open virtualbox or u can download in the official page. oke after that we are going to setting the virtual box.
go to file -> preferences -> network -> host only networks -> click twice
Adding a virtual adapter.png
right click in your virtual machine -> settings -> System -> Processor

Enable PAE NX
Network -> Adapter 2 -> ok
Setting up the Network Adapter

oke we are done, oke lets open your virtual machines and check your configuration !
if u used the debian distro u can use this command

#cat /etc/network/interfaces

and u will see your configuration adapters. now we are going to learning the basic of python first use your python command in terminal  and u will see the console. in this section we must import the modules first, oke what the definition of modules in python ?
A module is a file containing Python definitions and statements.

1. Knowing a dir and help command, for example:

#import sys
#help(sys) *showing a detail the sys modules
#dir(sys) *containing a sys statements that can be used

2. Make a script & execute it

#nano example.py
print raw_input(“Please fill what you want : “) *then exit ctrl+x -> y -> enter
#python example.py

3. Understanding a boolean operators


as u can see, i already give u a diagram of boolean operators, there are 3 boolean
AND, OR, NOT. oke lets try these all boolean

          command      result
(1==1) and (2==2)  true 
(1==2) and (2==3)  false
(1==1) or (2==2)     true 
(1==2) or (2==2)     true
(1==3) or (2==1)      false
not(1==1)                 false
not(1==2)                 true

4. Conversions between data types

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s