Data types and type conversion Gungun ledhu give oggy Outlook

bandiranvitha 7 views 17 slides May 06, 2025
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

Types of data


Slide Content

24R01A6672 DATATYPES AND TYPE CONVERSION

Data Types and Type Conversion in Python An Overview of Python Data Types and Type Conversion Techniques

What are Data Types? Data types specify the type of data a variable holds. Examples: int, float, str, bool.

Standard Data Types 1. Numeric 2. Sequence 3. Set 4. Mapping 5. Boolean 6. None Type

Numeric Types int: Integer values float: Floating point numbers complex: Complex numbers

Sequence Types str: String list: Ordered, mutable Tuple: Ordered, immutable

Set Types set: Unordered, mutable, no duplicates frozenset: Immutable set

Mapping Type dict: Key-value pairs, mutable

Boolean Type bool: Represents True or False

None Type None: Represents absence of a value or null

Mutable vs Immutable Mutable: list, dict, set Immutable: int, float, str, tuple, frozenset

What is Type Conversion? Changing the data type of a value into another type. Two types: Implicit, Explicit

Implicit Type Conversion Python automatically converts data types. Example: x = 10 y = 2.5 z = x + y # z is float

Explicit Type Conversion Manual conversion using functions: int(), float(), str(), etc. Example: x = '5' y = int(x)

Common Conversion Functions int(), float(), str(), list(), tuple(), set(), bool()

CONCLUSION Python supports multiple data types. Type conversion can be implicit or explicit. Understanding them is key to writing robust code.
Tags