0% found this document useful (0 votes)
8 views4 pages

1742271996_python_assignment

Python supports various built-in data types including integers, floats, strings, booleans, lists, tuples, and dictionaries. Each data type serves a specific purpose, such as representing numerical values, text, logical values, or collections of data. Understanding these data types is essential for effective programming in Python.

Uploaded by

R S Jeysiva
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)
8 views4 pages

1742271996_python_assignment

Python supports various built-in data types including integers, floats, strings, booleans, lists, tuples, and dictionaries. Each data type serves a specific purpose, such as representing numerical values, text, logical values, or collections of data. Understanding these data types is essential for effective programming in Python.

Uploaded by

R S Jeysiva
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
You are on page 1/ 4

Python data types

Introduction to Python Data Types

Python is a high-level programming language that supports various data types. A data type
is a classification of data based on its format, size, and set of values it can hold. Python has
several built-in data types that can be used to store and manipulate data.

*1. Integers (int)*

Integers are whole numbers, either positive, negative, or zero. They are used to represent
numerical values.

Example:

```

X=5

Y = -3

Z=0

```

*2. Floats (float)*

Floats are decimal numbers. They are used to represent numerical values with a fractional
part.

Example:

```

X = 3.14

Y = -0.5
Z = 0.0

```

Page 2: More Python Data Types

*3. Strings (str)*

Strings are sequences of characters. They are used to represent text.

Example:

```

X = “hello”

Y = ‘hello’

Z = “””This is a multi-line string”””

```

*4. Boolean (bool)*

Booleans are true or false values. They are used to represent logical values.

Example:

```

X = True

Y = False

```

*5. List (list)*


Lists are ordered collections of items. They are used to represent collections of data.

Example:

```

X = [1, 2, 3]

Y = [“a”, “b”, “c”]

Z = [1, “a”, 3.14]

```

Page 3: Even More Python Data Types and Conclusion

*6. Tuple (tuple)*

Tuples are ordered, immutable collections of items. They are used to represent collections
of data that should not be changed.

Example:

```

X = (1, 2, 3)

Y = (“a”, “b”, “c”)

Z = (1, “a”, 3.14)

```

*7. Dictionary (dict)*

Dictionaries are unordered collections of key-value pairs. They are used to represent
mappings of keys to values.
Example:

```

X = {“name”: “John”, “age”: 30}

Y = {“city”: “New York”, “country”: “USA”}

```

Python has several built-in data types that can be used to store and manipulate data.
Understanding these data types is essential for any Python programmer. By using the right
data type for the job

You might also like