Day 1

Installing python

one can install python using package manager depending upon the operating system you are using. As I have a windows machine and ubuntu using linux on windows subsystem. I can install python from And Ubuntu I can use below command to install python.

sudo apt-get install python3

Running python

To run python you would call python3 which open Python interpreter. On that you can type print(“Hello World”) to run your first python code which would print Hello World in next line.

To run python code from a file I would need to below text into a file, save suppose as

#!/usr/bin/env python3
print("Hello World!")

The file “” needs to be executable to be run the code. If file is not executable we can do it by chmod +x

then we can run file by calling it as ./

White space and indentation

Whitespace and indentation should be perfect for python. If a line is not correctly indented python interpreter would Indentation error. There are few basic rule to follow,

  • Use 4 spaces for indentation
  • Never mix tab and spaces
  • One line blank after functions
  • two lines blank after classes.
  • add a space after “,” in dicts, lists, tuples and argument list and after “:” in dicts
  • Spaces around assignments and comparers
  • no spaces after starting and before ending () brackets/parentheses


In python on can write comments starting with ‘#’ Still gonna check whether to use ’’’ for multiline comments or not. links:


Modules are link library which you can in import and run function from it.

Keywords and Indentifier

As any other language there are reserved keywords in python which cannot be used as ordinary identifiers. Below is the list of identifiers. Note: Identifiers are case sensitive they should be used with same casing.

and       del      from      not   while
as        elif     global    or    with
assert    else     if        pass  yield
break     except   import    print
class     exec     in        raise
continue  finally  is        return
def       for      lambda    try

We don’t need specify data type with python something similar to javascript where we use var for every type of variable.