Python Class
Introduction
Python is a popular programming language. It was created by
Guido van Rossum, and released in 1991.
It is used for:
web development (server-side),
software development,
mathematics,
AI and Machine Learning
Data Science
Python Syntax
Python Output Text
The print() function is often used to output variables.
FLOAT
INTEGER
Variables
Variables are containers for storing data values.
Variable Names
A variable can have a short name (like x and y) or a more descriptive name
(age, carname, total_volume).
Rules for Python variables:
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores
(A-z, 0-9, and _ )
Variable names are case-sensitive (age, Age and AGE are three different
variables)
A variable name cannot be any of the Python keywords.
Variable Names
Python Data Types
In programming, data type is an important concept.
Variables can store data of different types, and different types can do different things.
Python has the following data types built-in by default, in these categories:
Text Type: str
Numeric Types: int, float, complex
Boolean Type: bool
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set
Python input() Function
The input() function allows user input.
Syntax
input (prompt)
prompt A String, representing a default message before the input.
Python Casting
to specify a type on to a variable
int() float()
complex()
bool() str()
Escape Character
To insert characters that are illegal in a string, use an escape
character.
An escape character is a backslash \ followed by the character you
want to insert.
\' Single Quote
\\ Backslash
\n New Line
\” Double Quote
\t Tab
Operator Precedence
Operator precedence describes the order in which operations are performed.
Fraction Syntax
Numerator / Denominator
PROPER IMPROPER MIXED NUMBER
Numerator < Denominator Numerator >= Denominator interger + Fraction
What is a Module?
Consider a module to be the same as a code library.
A file containing a set of functions you want to include in your application.
Modules in Python for Mathmetics
Fraction Module
Decimal Module
Math Module
Numpy Module
Thank You
FOR YOUR ATTENTION!