codewithronny logo
codewithronny logo
  • Category
    • Adsense
    • Blog
    • Boilerplate
    • CodeWithRonny
    • Course Review
    • How to
    • HTML Tutorial
    • JavaScript
      • JavaScript Tutorial
    • Laravel
    • Machine Learning
      • Machine Learning Tutorial
    • MySQL
      • MySQL Tutorial
    • Networking
    • PHP Tutorial
    • Python
      • Data Structure Using Python
      • Python Interview Question
      • Python Tutorial
    • Python Coding Interview Practice
    • Server
      • Share Hosting
    • Tech Celebrity
    • Web Technologies and Development
    • Wordpress
      • Theme
  • Information
    • Contact Us
    • About Us
    • Privacy Policy
    • Terms
    • Disclaimer
  • Code Editor
    • HTML Code Editor
    • Python Code Editor
Python Tutorial
Python TutorialPython VariablesVariables Name in PythonPython Variables - Multiple Value AssignmentPython Data Types

Python Data Types


In computer science data types are very important and basic concept that represents the nature of data that can be handle within a computer program.

Python data types are the classification and grouping of data items. It describe the type of value that tells what operations can be performed on a particular data.

Python has default Built-in data types in these category

Category Python Data Types
Text Type:str
Numeric Types:int, float, complex
Sequence Types:list, tuple, range
Mapping Type:dict
Set Types:set, frozenset
Boolean Type:bool
Binary Types:bytes, bytearray, memoryview
None Type:NoneType
Data Types in Python
Python Data Types

How to get data type in Python

We can use Python Built-in function type()to get the dat type of any objects.

a = "codewithronny.com"
print(type(a))
Run

Why do we set data types

In Python data types automatically set when user assign a value to variables. There is no need to declare type of variable in Python.

Sample CodeData TypesRun
a = "Hello Freaks"strRun
a = 40intRun
a = 540.5floatRun
a = 1zcomplexRun
a = ["Protein", "Calcium", "Minerals"]listRun
a = ("Protein", "Calcium", "Minerals")tupleRun
a = {"name" : "Ronny", "age" : 27}dictionaryRun
a = {"Protein", "Calcium", "Minerals"}setRun
a = frozenset({"Protein", "Calcium", "Minerals"})frozensetRun
a = range(10)rangeRun
a = TruebooleanRun
a = b"Hello"bytesRun
a = bytearray(8)bytearrayRun
a = memoryview(bytes(20))memoryviewRun
a = NoneNone TypeRun






codewithronny logo
codewithronny logo

A Tutorial Cafe

  • Twitter
  • Facebook
  • Instagram
  • Linkedin
  • Linkedin
Company
    About Us
  • Contact Us
  • Career
Community
    Documentation
  • Faq
  • Sitemap
Explore
    Terms & Conditions
  • Privacy policy
  • Disclaimer
  • Affiliate Disclosure
  • Become an Author
  • How to guide
Contact


Copyrights ©2024 CodeWithRonny
  • GlobeLanguage Chevron
    • English
    • Hindi
  • Terms of use
  • Cookies
  • Sitemap