Django

Python Basics

Variables & constants, data types, control flow, functions, list comprehensions, decorators, context managers

25 คำถามสัมภาษณ์·
Junior
1

What is the difference between a variable declared with = and a constant in Python?

คำตอบ

Python does not have true constants at the language level. By convention, UPPERCASE variables are considered constants and should not be modified, but nothing technically prevents reassignment. This PEP 8 convention relies on developer discipline rather than language enforcement.

2

What data type does the expression 3 / 2 return in Python 3?

คำตอบ

In Python 3, the / operator always performs floating-point division, returning 1.5 in this case. To get integer division, use the // operator. This is a major difference from Python 2 where / performed integer division between two integers.

3

What is the difference between a list and a tuple in Python?

คำตอบ

Lists are mutable (modifiable after creation) while tuples are immutable. Tuples are slightly more performant and can be used as dictionary keys. Lists use square brackets [] and tuples use parentheses (). Choose the right type based on whether data needs to be modified.

4

How to check if a key exists in a Python dictionary?

5

What is the difference between == and is in Python?

+22 คำถามสัมภาษณ์

เชี่ยวชาญ Django สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี