Python Documentation
Python Introduction :
- Install python in the local machine
- We will do installation with anaconda(Open source distribution of python) distribution
- Along with anaconda we also will get conda which is a package manager(Dozens of libraries
related to machine learning, data science, AL and also simple array libraries which will allow
to download content from websites etc ).
- Conda is responsible for download all of this libraries .
Interacting with the python:
- Interact with python by using command prompt
- Create a directory
- Check python installed or not cmd – python
- Get out of the shell this is not where we are writing our python code
- In order to work with python we need to be in conda pkg manager env for this we need to
activate default env on our windows command prompt: Activate Base (base is default virtual
env )
- Activate base allow us to work with conda package , work with python
- Bring up the Jupiter notebook – this is the browser based interactive shell (Kind of IDE)
- The code written in Jupiter notebook will save in our local machine and it will have .ipynb
ext .
- For new note book – new – select python 3 – rename the
- Write the code in cell and – Shift+Enter in order to execute the code
- !python –version – this is not a python cmd instead it is a shell cmd
On Mac Machine :
- Download and install
.
- ls to see the list of directories
Jupyter norebook will run the server in mac machine – open up new browser
Using Python as a calculator :
- Shift+enter to create new code shell in jupyter
-
BADMOS
Functions :
- Jupyter notebook echo whaterver you type number or string
- If you want to write code – print (“Hello ”) – function
- Strings can be defined by using “ or ‘
- len function to calculate the length of Character in a string
Variables:
Assign values to Variables:
Comparison operators result in boolean value
Data Types :
Creating Single line , Multi lines strings :
\ escape char – not consider next immediate char