INFOX IT TRAINING,
A little bit history of Python:
Python was conceived in the late 1980s by Guido Van Rossum and was first released in 1991. Even though it came out earlier than Java(which was introduced in 1995) but it didn’t get much popularity until late the 2000s. In late 2000s Google started using Python heavily and started reinvesting on language and since then it has been more popular every day. Top universities like Harvard, MIT, Stanford have prioritized this language to be taught.
- Python is easy to learn.
- It is easier to follow along because of
- English like structures. eg. is used to display hello, world.
- Python is dynamically typed. ie.
- Python has many one-liners.
- So basically Python is easy to learn.
Where is Python used?
(Hint: Basically everywhere)
- Web Apps:
- For web apps, Python has its own libraries like Flask, Pyramid and Django to build rapid web development.
- Companies like DISQUIS, MOZILLA, PBS, NASA, REDDIT use Python for a web application.
- Scientific computing:
- Its also used in different scientific computing.
- Python has general libraries like NumPy, SciPy for basic scientific computations.
- And there are specific libraries like EarthPy for earth sciences and AstroPy for Astronomy and sciences.
- Data Science and Machine Learning:
- Companies like Facebook, Google, Amazon have a huge collection of our data and they market using those data.
- For those data analytics, there is a huge number of Python libraries.
- NumPy, SciPy, Matplotlib(Chart), Seaborn(Statistics), Plotly etc are hugely used for data analytics
- Google has Tensorflow, Microsoft has Keras and Facebook uses PyTorch for different Machine Learning and Neural Network computation.
- And the list goes on……
- Basically, Python is used everywhere
- PyGame for Game Development and Tkinter of Python for the desktop app and there are a huge number of libraries written for GUI.
- It is an interpreted language.
- Source code—-> Interpreter—>Output
- The interpreter interprets the language line by line and Python virtual machine runs through it and parses it and executes it.
- Python has different versions. Python 2, Python 2.7 but we will be using Python 3.6 for our training.
- Goto http://anoconda.org
- Download Python 3.6 version anaconda.
- Install it.
- Open Anaconda Navigator.
- Run Jupyter Notebook
Some differences in C and Python
- After all, this installation Python can be simply used by calling Python command in command or terminal.
- As we type along the Python interpreter interprets the code line by line.
- But generally, we prefer using Jupiter Notebook because it has more advanced features and is more user-friendly than a command line interface.
Basic Data Types
As in any other programming language Python has a number of basic data types like
These are dynamically typed meaning we don’t explicitly need to define what type of variables are we handling within Python.
Integers and floats work in the same way as we expect from other languages
Unlike many other languages, Python does not have unary increment(x++) or decrement(x–) operators.
Python implements all the usual operators for Boolean logic but uses English words rather than symbols (&&, ||, etc.)
Python has great support for strings.
String also has a bunch of methods like
Python has many built-in containers like lists, tuples, dictionaries, sets.
- Lists are like arrays in any other language.
- But unlike in any other language, lists is resizable and can contain elements of different type.
For more info about lists, documentation can be really helpful.
Slicing: In addition to accessing list elements one at a time, Python provides concise syntax to access sublists; this is known as slicing.