Python – Data Type Conversion
Practice
Python Data Types
2
The type of a variable is specified using Python Data Types.
It outlines the kind of information we'll put in a
variable.
Many forms of data can be kept in memory.
A person's address and age, for instance, are both kept as
alphanumeric characters and numeric values, respectively.
Python Built-In Data Types
3
Numeric • int, float, complex
String • str
Sequence • list, tuple, range
Mapping • dict
Boolean • bool
Set • set, frozenset
Python String Data Type
4
Week_3/[Link]/cell_1 Run code: shift + enter
Python Numeric Data Type
5
Week_3/[Link]/cell_2
Python List Data Type
6
Week_3/[Link]/cell_3
Python Tuple Data Type
7
Week_3/[Link]/cell_4
Python Boolean Data Type
8
Week_3/[Link]/cell_5
Python Data Type Conversion
9
Sometimes, you may need to perform
conversions between the built-in data types.
• To convert data between different Python data types,
you simply use the type name as a function.
Week_3/[Link]/cell_6
Python Data Type Conversion
10
Week_3/[Link]/cell_7
Class Project
Project 1
12
• Develop the pseudocode and flowchart for store
checkout after purchase
A
• Design a flowchart for your typical weekday morning
routine.
B
• Develop an algorithm that takes as input two names
and their corresponding age and then swap the ages.
C
requested to
Project
develop a 2
program
to algorithm and
Python code to
13
find the root of a
Cubic Equation:
Ax3 + Bx2 + Cx + D
= 0, the roots of a
Quartic Equation,
and the roots of a
quadratic
equation.
Should you
choose to
accomplish the
mission, write a
Python program