LimioLearn in Flow
🏆 Đấu trường
Đăng nhậpĐăng ký
← Programming for Data Science

Bạn đang xem thử công khai

Đăng nhập để lưu tiến độ, làm bài tập, thảo luận và nhận phản hồi.

Đăng nhập
Module 1: Fundamentals of Python Programming

1.6 Tuple, Set, Dictionary, and Type Conversion

In / Lưu PDF

1.6 Tuple, Set, Dictionary, and Type Conversion

After this unit you will: choose the right collection type for each problem.

Key points

TypeOrderedMutableDuplicates
List []YesYesAllowed
Tuple ()YesNoAllowed
Set {}NoYesNot allowed
Dict {k: v}YesYesKeys are unique
  • A one-element tuple needs a comma: (50,).
  • A dictionary can be nested: students["s1"]["name"].
  • int(3.99) is 3 — int() truncates the decimal part rather than rounding.