Saturday, October 19, 2019

Let's Get Started!



Lets get Started!

1. Running Jupyter:
You can execute your program in Jupyter. This can be accessed from notebooks.azure.com for creating libraries. It has pandas and numpy packages installed, where you do not have to install separately.

2. Importing libraries using 'import' statement and alias:
To import pandas and numpy libraries, use following statement-
  • import pandas as pd
  • import numpy as np

3. Print statement:
To print statement-
  • print('hello')

4. Loops using 'for' and 'while':

6. Python 2 Vs Python 3:
There is difference in Python version. E.g is given below-
  • print 'hello' - In python 3, this statement will not be executed but it will print in python 2.

7.Dictionary and Lists:
  • Dictionary: As the name says, it hold word-meaning pairs. Similarly, Python dictionary holds key-value pair. To declare dictionary:   
          >>>xdict={'x':1, 'y':2} # is key and is value.
          >>>xdict
  Output: {'x':1 , 'y':2 }

  • List: Python doesn't support arrays, so it has List. To declare list:
         >>>xlist = [1,2,3,4]
        >>>xlist
  Output:  [1,2,3,4]
       >>>for x in xlist
                        print(x)
  Output:  1 2 3 4
      >>>ylist=[1,[2,3],(4,5)False, 'No']
               >>>ylist
  Output:  [1,[2,3],(4,5)False, 'No']



No comments:

Post a Comment