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.2 Variables, Input and Output

In / Lưu PDF

1.2 Variables, Input and Output

After this unit you will: declare variables following the conventions, print results neatly and read data from the user.

Key points

  • Naming: variables and functions use snake_case, constants use UPPER_SNAKE_CASE, classes use PascalCase.
  • del x deletes the name x; using x afterwards causes a NameError.
  • print(*objects, sep=' ', end='\n') — sep is what is inserted between values, end is what is inserted at the end.
  • f-string: f"{score:.2f}" prints 2 decimal places.
  • input() always returns a string — to do calculations you must convert the type: int(input(...)).