• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 3 pages
Summary

Summary Data Types in Python

Document preview thumbnail
Preview 1 out of 3 pages

Python has several built-in data types that are used to store different kinds of information. These data types are classified into several categories: numeric, sequence, mapping, set, and boolean.

Content preview

Data Types in Python
Python has several built-in data types that are used to store different kinds of information.
These data types are classified into several categories: numeric, sequence, mapping, set, and
boolean. Here is a detailed overview of each data type in Python:


1. Numeric Types
Integer ( int ): Whole numbers, positive or negative, without decimals.

age = 30
temperature = -20
Floating-point ( float ): Numbers with a decimal point.

price = 19.99
gravity = 9.8
Complex ( complex ): Numbers with a real and an imaginary part.

complex_number = 1 + 2j


2. Sequence Types
String ( str ): Sequence of characters, enclosed in single or double quotes.

name = "Alice"
greeting = 'Hello, World!'
List ( list ): Ordered, mutable collection of items.

fruits = ["apple", "banana", "cherry"]
numbers = [1, 2, 3, 4, 5]
Tuple ( tuple ): Ordered, immutable collection of items.

coordinates = (10, 20)
colors = ("red", "green", "blue")
Range ( range ): Represents a sequence of numbers.

numbers = range(1, 10)


3. Mapping Type
Dictionary ( dict ): Unordered collection of key-value pairs.
person = {"name": "Alice", "age": 30}


4. Set Types
Set ( set ): Unordered collection of unique items.

unique_numbers = {1, 2, 3, 3, 2}

Document information

Uploaded on
November 4, 2024
Number of pages
3
Written in
2024/2025
Type
Summary
$6.41

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
1
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions