Python for Non-Programmers
Installing Python
This is the site to install Python -> https://www.python.org/downloads/
Installing PyCharm
This is the site to install PyCharm -> https://www.jetbrains.com/pycharm/
Installing Anaconda
This is the site to install Anaconda -> https://www.anaconda.com/
Intro to Jupyter Notebook
Jupyter Notebook is a browser-based interpreter that allows us to interactively
work with Python
Variables in Python
How do I
store data?
“John”
“Sam”
“Matt”
Variables in Python
Data/Values can be stored in temporary storage spaces called variables
Student
“John”
0x1098ab
Variables in Python
Data/Values can be stored in temporary storage spaces called variables
“John” “Sam” “Matt”
DataTypes in Python
Every variable is associated with a data-type
10, 500 3.14, 15.97 TRUE, FALSE “Sam”, “Matt”
int float Boolean String
Operators in Python
Arithmetic Operators
Relational Operators Logical Operators
Python Tokens
Smallest meaningful Component in a Program
Keywords
Identifiers
Literals
Operators
Python Keywords
Keywords are special reserved words
False class Finally Is Return
None continue For Lambda Try
True def From Nonlocal While
and del Global Not With
as elif If Or Yield
Python Identifiers
Identifiers are names used for variables, functions or objects
Rules
No special character expect _(underscore)
Identifiers are case sensitive
First Letter cannot be a digit
Python Literals
Literals are constants in Python
I’m a constant.
I don’t change
Python Strings
Strings are sequence of characters enclosed within single quotes(‘ ’), double
quotes(“ “) or triple quotes(‘’’ ‘’’)
‘’’ I am going to
‘Hello World’ “This is Sparta”
France tomorrow’’’
Extracting Individual Characters
String Functions
Finding length of string Converting String to lower case Converting String to upper case
String Functions
Replacing a substring
Number of occurrences of substring
String Functions
Finding the index of substring
Splitting a String