AI and ML With Python: Chapter 1: Introduction To Python
AI and ML With Python: Chapter 1: Introduction To Python
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’)