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.4 Numbers, Booleans and Strings

In / Lưu PDF

1.4 Numbers, Booleans and Strings

After this unit you will: correctly predict whether a value is truthy or falsy, and slice a string at the right positions.

Key points

  • Falsy: False None 0 0.0 '' [] () {} set(). Everything else is truthy — even the string "False".
  • True + True equals 2 (booleans are numbers).
  • Strings are indexed from 0; the slice s[a:b] stops just before b; s[::-1] reverses.
  • Strings are immutable: you cannot change individual characters.