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.3 Operators and Expressions

In / Lưu PDF

1.3 Operators and Expressions

After this unit you will: read and write expressions correctly, and know which operator runs first.

Key points

  • / always gives a float; // is floor division (rounds down); % is the remainder; ** is exponentiation.
  • n % 2 == 0 checks whether n is even.
  • == compares values; is checks whether two names point to the same object, and is commonly used to check for None.
  • Precedence from highest to lowest: **, then * / % //, then + -, then comparisons, then is/in, and finally not and or.