No products in the cart.

What are rhe four data type …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

What are rhe four data type in python
  • 1 answers

Gaurav Seth 4 years, 3 months ago

Python has the following standard or built-in data types:

Numeric

A numeric value is any representation of data which has a numeric value. Python identifies three types of numbers:

  • Integer: Positive or negative whole numbers (without a fractional part)
  • Float: Any real number with a floating point representation in which a fractional component is denoted by a decimal symbol or scientific notation
  • Complex number: A number with a real and imaginary component represented as x+yj. x and y are floats and j is -1(square root of -1 called an imaginary number)

Boolean

Data with one of two built-in values <code>True</code> or <code>False</code>. Notice that 'T' and 'F' are capital. <code>true</code> and <code>false</code> are not valid booleans and Python will throw an error for them.

Sequence Type

A sequence is an ordered collection of similar or different data types. Python has the following built-in sequence data types:

  • String: A string value is a collection of one or more characters put in single, double or triple quotes.
  • List : A list object is an ordered collection of one or more data items, not necessarily of the same type, put in square brackets.
  • Tuple: A Tuple object is an ordered collection of one or more data items, not necessarily of the same type, put in parentheses.

Dictionary

A dictionary object is an unordered collection of data in a key:value pair form. A collection of such pairs is enclosed in curly brackets. For example: <code>{1:"Steve", 2:"Bill", 3:"Ram", 4: "Farha"}</code>

type() function

Python has an in-built function type() to ascertain the data type of a certain value. For example, enter <code>type(1234)</code> in Python shell and it will return <code><class 'int'></code>, which means 1234 is an integer value. Try and verify the data type of different values in Python shell, as shown below.

http://mycbseguide.com/examin8/

Related Questions

What are called tokens
  • 2 answers
What is mean by buffering in file handling?
  • 1 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App