Home | | Computer Science 12th Std | Python Data types

Python - Python Data types | 12th Computer Science : Chapter 5 : Core Python : Python Variables and Operators

Chapter: 12th Computer Science : Chapter 5 : Core Python : Python Variables and Operators

Python Data types

All data values in Python are objects and each object or value has type.

Python Data types

All data values in Python are objects and each object or value has type. Python has Built-in or Fundamental data types such as Number, String, Boolean, tuples, lists and dictionaries.

 

1. Number Data type

The built-in number objects in Python supports integers, floating point numbers and complex numbers.

Integer Data can be decimal, octal or hexadecimal. Octal integer use O (both upper and lower case) to denote octal digits and hexadecimal integer use OX (both upper and lower case) and L (only upper case) to denote long integer.

Example :

102, 4567, 567     # Decimal integers

O102, o876, O432         # Octal integers

OX102, oX876, OX432 # Hexadecimal integers

34L, 523L   # Long decimal integers

A floating point data is represented by a sequence of decimal digits that includes a decimal point. An Exponent data contains decimal digit part, decimal point, exponent part followed by one or more digits.

Example :

123.34, 456.23, 156.23 # Floating point data

12.E04, 24.e04     # Exponent data

Complex number is made up of two floating point values, one each for the real and imaginary parts.

 

2. Boolean Data type

A Boolean data can have any of the two values: True or False.

Example :

Bool_var1=True

Bool_var2=False

 

3. String Data type

String data can be enclosed with single quote or double quote or triple quote.

Example :

Char_data = ‘A’

String_data= "Computer Science"

Multiline_data= ”””String data can be enclosed with single quote or  double quote or triple quote.”””

 

Tags : Python , 12th Computer Science : Chapter 5 : Core Python : Python Variables and Operators
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Science : Chapter 5 : Core Python : Python Variables and Operators : Python Data types | Python


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.