• Saat ini Anda mengakses IndoForum sebagai tamu, sehingga Anda tidak memiliki akses penuh untuk melihat artikel dan diskusi yang hanya tersedia bagi anggota. Dengan bergabung, Anda akan mendapatkan akses penuh untuk bertanya, mengirim pesan pribadi, mengikuti polling, dan menggunakan fitur-fitur lainnya. Proses pendaftaran sangat cepat, mudah, dan gratis.
    Silakan daftar dan validasi email Anda untuk mendapatkan akses penuh sebagai anggota. Harap masukkan alamat email yang valid dan periksa kotak masuk Anda setelah mendaftar untuk proses validasi.

What are Python's built-in data types?

shivanis09

IndoForum Newbie F
No. Urut
296054
Sejak
21 Agt 2024
Pesan
1
Nilai reaksi
0
Poin
1
Python offers a variety of built-in data types to represent different kinds of data. Here's a breakdown:

Numeric Types​

  • int: Represents integer numbers (e.g., 10, -5, 0)
  • float: Represents floating-point numbers (e.g., 3.14, 2.5)
  • complex: Represents complex numbers (e.g., 2+3j)

Text Type​

  • str: Represents sequences of characters (e.g., "Hello, world!")

Sequence Types​

  • list: Ordered and mutable collection of items (e.g., [1, 2, 3, "apple"])
  • tuple: Ordered and immutable collection of items (e.g., (1, 2, 3))
  • range: Represents an immutable sequence of numbers (e.g., range(5))

Mapping Type​

  • dict: Unordered collection of key-value pairs (e.g., {'name': 'Alice', 'age': 30})

Set Types​

  • set: Unordered collection of unique elements (e.g., {1, 2, 3})
  • frozenset: Immutable version of set (e.g., frozenset({1, 2, 3}))

Boolean Type​

  • bool: Represents truth values (True or False)

Binary Types​

  • bytes: Immutable sequence of bytes
  • bytearray: Mutable sequence of bytes
  • memoryview: Object providing a view of the memory of an existing object

Special Type​

  • NoneType: Represents the absence of a value (None).

Read More....Python Training in Mumbai
 
Python has several built-in data types used to store different kinds of data. The primary ones are:

  1. int – Integer numbers (e.g., 5, -3, 100).
  2. float – Floating-point numbers (e.g., 3.14, -0.001).
  3. str – Strings (e.g., "Hello", 'Python').
  4. list – Ordered, mutable collection of items (e.g., [1, 2, 3]).
  5. tuple – Ordered, immutable collection of items (e.g., (1, 2, 3)).
  6. set – Unordered collection of unique items (e.g., {1, 2, 3}).
  7. dict – Key-value pairs (e.g., {'name': 'Alice', 'age': 25}).
  8. bool – Boolean values (True, False).
These types support various operations and are foundational for programming in Python.
 
 URL Pendek:

| JAKARTA | BANDUNG | PEKANBARU | SURABAYA | SEMARANG |

Back
Atas.