Search Bar

Saturday 6 May 2023

Python Programming Tut#06|Data Types

Python Tutorial 06

Data Types in Python

Python is a dynamically-typed programming language, which means that you do not need to explicitly declare the data type of a variable before using it. The data type of a variable is determined automatically based on the value assigned to it.

However, Python has several built-in data types that you can use, including:

Numbers: int (integer), float (floating-point number), and complex (complex number).

Strings: a sequence of characters enclosed in quotation marks.

Boolean: a data type that can have one of two values: True or False.

Lists: an ordered collection of items, which can be of any data type.

Tuples: similar to lists, but immutable (cannot be changed).

Sets: an unordered collection of unique items.

Dictionaries: a collection of key-value pairs, where each key is associated with a value.

Here's an example of how to create variables of different data types in Python:
Python Programming Tutorial 06|Data Types
Python Programming Tutorial 06|Data Types


You can also use type() function to check the data type of a variable. For example:
Python Programming Tutorial 06|Data Types
Python Programming Tutorial 06|Data Types


0 comments:

Post a Comment