Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Introduction to Python

What is Python?
2

 Python is an interpreted, object-oriented, high-level


programming language with dynamic semantics.

Programming & Data Analytics using Python


What is Python?
3

 Python is a cross-platform programming language, which


means it runs on all the major operating systems.

Programming & Data Analytics using Python


Variables
4

Variables = Value Holders.


Python Interpreter associates the value with the
variable.
A

53.8

Programming & Data Analytics using Python


Variables – Naming Conventions
5

 Variable names can contain only letters, numbers, and


underscores.
 It can start with a letter or an underscore, but not with a number.
 Spaces are not allowed in variable names, but underscores can be
used instead.
 Avoid using Python keywords and function names as variable
names.
 Variable names should be short but descriptive.
 Be careful when using the lowercase letter l and the uppercase letter O
because they could be confused with the numbers 1 and 0.

Programming & Data Analytics using Python


Python Keywords
6

and continue finally is raise


as def for lambda return
assert del from None True
async elif global nonlocal try
await else if not while
break except import or with
class False in pass yield

Reference: https://realpython.com/python-keywords/

Programming & Data Analytics using Python


Access Keywords
7

Programming & Data Analytics using Python


Datatypes
8

Strings:
Numbers:
 Integer
 Float

Programming & Data Analytics using Python


Strings
9

String  a series of characters.


Anything inside quotes (“ ”) or (‘ ’) is considered a
string in Python.

This flexibility allows us to use quotes and


apostrophes within the strings.

Programming & Data Analytics using Python


Changing Case in a String
10

title():

upper() & lower():

Reference: https://www.w3schools.com/python/python_ref_string.asp
Programming & Data Analytics using Python
String Concatenation
11

+ operator:

Programming & Data Analytics using Python


Adding Whitespaces in Strings
12

Whitespace refers to any nonprinting character, such


as spaces, tabs, and end-of-line symbols.
Whitespaces can be used to organize the output so
it’s easier for users to read.

Programming & Data Analytics using Python


Stripping Whitespaces
13

rstrip(), lstrip() & strip():

Programming & Data Analytics using Python


Numbers
14

Mathematical Operators on Integers:

Programming & Data Analytics using Python


Mathematical Operators
15

Floats:

Programming & Data Analytics using Python


THANK YOU

You might also like