You are on page 1of 19

AI and ML with

Python

Chapter 1 : Introduction to Python


Chapter 1:
Introduction to
Python
Let's start with Python!
What is Python?
● Python is a general purpose programming language.
● It is often applied in scripting roles.
● So Python is a programming language as well as scripting
language.
Who Developed
Python?
Guido Van Rossum
History of Python
● Developed in the Netherlands, early 90s by Guido van
Rossum.
● Python was conceived in the late 1980s and its
implementation was started in December 1989.
● Guido van Rossum was a fan of ‘Monty Python’s Flying
Circus’, this is a famous TV show in Netherlands.
● Named after Monty Python.
● Open sourced from the Beginning.
● Google makes extensive use of
Python in its web search system
and has employed Python’s
creator.
● Intel, Cisco, Hewlett-Packard,
Seagate,Qualcomm and IBM use
Python for hardware testing.
The Youtube video sharing service
Who uses ●

Python is largely written in Python.

Today?
● System Programming.
● GUI Programming.
● Internet Scripting.
● Business Analytics.
● Artificial Intelligence and
Machine Learning.
● Gaming,XML,Robotics and
more.
What can i do
with Python?
A Sample Code
Understanding the Code
● Indentation matters to code meaning.
■ Block structure indicated by indentation.
● First Assignment to a variable creates it.
■ Variable types don't need to be declared.
■ Python figures its variable types on its own.
● Assignments is = and Comparison is ==.
● For numbers +,-, *, /, % are used for mathematical operations.
■ Special use for + for string concatenation and % for
string formatting.
Understanding the Code
● Logical Operators are words(and,or not) not symbols.
● The Basic printing command is print().
Python Code Execution
● Source code you type is checked for errors by the interpreter. It is converted into
byte code if no errors found. Finally Byte code is executed on Python Virtual
Machine(PVM) to give output. PVM halts with an error message in case of runtime
errors.
Running Python
Softwares to Use
● We can use many different web-based or desktop softwares.
Some of the Popular ones are :
■ Google Colab
■ Jupyter Notebook
■ Pycharm
■ Anaconda
● We Recommend using - Google Colab
○ Link : https://colab.research.google.com/
Let's Open Google Colab and Create a New
Python Notebook.
Rename the Notebook to My Python
Notebook.
Type the Following Command and Click on Run
Button.
Print() Method
● Print() method is used to print the data that you pass to the method.
● The data can be your name , country name, city etc.
● Note : Python is case sensitive. So use lowercase print().
● Exercise:
○ Print your name, country and city.
● Solution:
○ print(‘My name is Nilesh’)
○ print(‘My country is India’)
○ print(‘My City is Delhi’)

NOTE : use single quotes (‘ ‘) or double quotes inside print method.


Both will work fine.
Screenshot of Exercise
Thank You

You might also like