Basic Data Types in Python | Python Web Development For Beginners

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

At the end of 2019, Python is one of the fastest-growing programming languages. More than 10% of developers have opted for Python development.

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

Table of Contents  hide 

I Mutable objects

II Immutable objects

III Built-in data types in Python

Mutable objects

The Size and declared value and its sequence of the object can able to be modified called mutable objects. 

Mutable Data Types are list, dict, set, byte array

Immutable objects

The Size and declared value and its sequence of the object can able to be modified.

Immutable data types are int, float, complex, String, tuples, bytes, and frozen sets.

id() and type() is used to know the Identity and data type of the object

a**=25+**85j

type**(a)**

output**:<class'complex'>**

b**={1:10,2:"Pinky"**}

id**(b)**

output**:**238989244168

Built-in data types in Python

a**=str("Hello python world")**#str

b**=int(18)**#int

c**=float(20482.5)**#float

d**=complex(5+85j)**#complex

e**=list(("python","fast","growing","in",2018))**#list

f**=tuple(("python","easy","learning"))**#tuple

g**=range(10)**#range

h**=dict(name="Vidu",age=36)**#dict

i**=set(("python","fast","growing","in",2018))**#set

j**=frozenset(("python","fast","growing","in",2018))**#frozenset

k**=bool(18)**#bool

l**=bytes(8)**#bytes

m**=bytearray(8)**#bytearray

n**=memoryview(bytes(18))**#memoryview

Numbers (int,Float,Complex)

Numbers are stored in numeric Types. when a number is assigned to a variable, Python creates Number objects.

#signed interger

age**=**18

print**(age)**

Output**:**18

Python supports 3 types of numeric data.

int (signed integers like 20, 2, 225, etc.)

float (float is used to store floating-point numbers like 9.8, 3.1444, 89.52, etc.)

complex (complex numbers like 8.94j, 4.0 + 7.3j, etc.)

A complex number contains an ordered pair, i.e., a + ib where a and b denote the real and imaginary parts respectively).

String

The string can be represented as the sequence of characters in the quotation marks. In python, to define strings we can use single, double, or triple quotes.

# String Handling

'Hello Python'

#single (') Quoted String

"Hello Python"

# Double (") Quoted String

"""Hello Python"""

'''Hello Python'''

# triple (''') (""") Quoted String

In python, string handling is a straightforward task, and python provides various built-in functions and operators for representing strings.

The operator “+” is used to concatenate strings and “*” is used to repeat the string.

"Hello"**+**"python"

output**:**'Hello python'

"python "***2**

'Output : Python python '

python web development data types in python list of all python data types python data types python datatypes python types python variable type

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire Python Developers

Are you looking for experienced, reliable, and qualified Python developers? If yes, you have reached the right place. At **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")**, our full-stack Python development services...

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

Hire Dedicated eCommerce Web Developers | Top eCommerce Web Designers

Build your eCommerce project by hiring our expert eCommerce Website developers. Our Dedicated Web Designers develop powerful & robust website in a short span of time.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

A Beginner’s Guide to Accessing Data with Web APIs (using Python)

Harness the power of web APIs to tap into bountiful sources of rich, structured data for your data science projects. A Beginner’s Guide to Accessing Data with Web APIs (using Python)