HANDS ON

PYTHON


WHAT IS PYTHON?

  • A dynamic, interpreted, high-level language
  • Does not require declaring the types of variables or parameters or methods
  • Extremely readable
  • Used for solving a really wide range of problems
  • Object-oriented
  • Does not force Object-orientation
  • Has and requires common sense

Who all are using Python?

 

and the list goes on...

Why Python?

  • Used by many companies across the world including Google, Rackspace, Industrial Light and Magic, Flickr and many others.
  • A thriving community of developers and contributors and third party application developers.
  • PyPI (Python Package Index) lists about 33500 third-party software projects*... You name an area, there must be a Python package in it and mostly opensource and free!
  • Interpreted, dynamically typed, clean syntax, very easy to learn.
  • Learn Python in an Afternoon ;) - http://docs.python.org/2/tutorial/

Title

WHAT IS PYTHON?

  • A dynamic, interpreted, high-level language
  • Does not require declaring the types of variables or parameters or methods
  • Extremely readable
  • Used for solving a really wide range of problems
  • Object-oriented
  • Does not force Object-orientation
  • Has and requires common sense

Title

Title

Who all are using Python?

 

and the list goes on...

Why Python?

  • Used by many companies across the world including Google, Rackspace, Industrial Light and Magic, Flickr and many others.
  • A thriving community of developers and contributors and third party application developers.
  • PyPI (Python Package Index) lists about 33500 third-party software projects*... You name an area, there must be a Python package in it and mostly opensource and free!
  • Interpreted, dynamically typed, clean syntax, very easy to learn.
  • Learn Python in an Afternoon ;) - http://docs.python.org/2/tutorial/
 

Hello, world

How it's done with Java and C++


public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
} 

#include 
main()
{
    cout << "Hello World!";
    return 0;
} 
 
Requires a LOT more than just common sense.

The Pythonic way

Common sense: When you want to print a string, just print it.

In Python interpreter
 >>> print "Hello, world."

As a script
Open your favorite editor and type
#! /usr/bin/env python
print "Hello, world."
and save it as hello.py. And then execute it from command line as below
$ python hello.py

If-else , the control flow

if expr1:
    do this
elif expr2:
    do that
...
...
...
else:
   do whatever 
Truth value testing
DO
if x:
    pass 
DON'T
if x == True:
    pass


HANDS ON PYTHON

By magicharshit

HANDS ON PYTHON

  • 128