Django

Python Basics

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

25 mülakat soruları·
Junior
1

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

Cevap

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?

Cevap

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?

Cevap

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 mülakat soruları

Bir sonraki mülakatın için Django'de uzmanlaş

Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.

Ücretsiz başla