What are the built-in types of python?

By ayush goel in 22 Sep 2023 | 04:08 pm
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

What are the built-in types of python?

22 Sep 2023 | 04:08 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

Python has several built-in data types, including:

  • Numeric types (int, float, complex)
  • Sequences (list, tuple, range)
  • Text type (str)
  • Mapping (dict)
  • Set types (set, frozenset)
  • Boolean type (bool)
  • Binary types (bytes, bytearray, memoryview)
  • NoneType (None
22 Sep 2023 | 06:33 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023
  • In Python 2, range and xrange are used for creating sequences of numbers.
  • range returns a list containing all the numbers in the specified range. It generates the entire list in memory.
  • xrange, on the other hand, returns an xrange object, which is an iterable. It generates numbers on-the-fly as needed, making it more memory-efficient for large ranges.
  • In Python 3, range itself behaves like xrange from Python 2, so there's no xrange in Python 3.
22 Sep 2023 | 06:34 pm
0 Likes

Report

Please describe about the report short and clearly.