0% found this document useful (0 votes)
12 views16 pages

Python Class

Python is a versatile programming language created by Guido van Rossum in 1991, used for various applications including web development, AI, and data science. It features a range of data types, variable naming conventions, and functions like print() and input(). Additionally, Python supports modules for mathematical operations and emphasizes the importance of operator precedence and data type casting.

Uploaded by

Yoon Mhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views16 pages

Python Class

Python is a versatile programming language created by Guido van Rossum in 1991, used for various applications including web development, AI, and data science. It features a range of data types, variable naming conventions, and functions like print() and input(). Additionally, Python supports modules for mathematical operations and emphasizes the importance of operator precedence and data type casting.

Uploaded by

Yoon Mhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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!

You might also like