Govt. Exams
Entrance Exams
x += 3 is equivalent to x = x + 3. Starting with x=5, after adding 3, x becomes 8.
The 'in' operator checks if 'a' is a substring of 'banana'. It is present (multiple times), so it returns True.
This is a ternary conditional expression. Since 5 > 3 is True, the expression evaluates to 10 (the value before 'if').
The string 'Python' has 6 characters: P-y-t-h-o-n. len() returns the number of characters in a string.
In Python 3, the division operator (/) always returns a float, regardless of whether the operands are integers. 5 / 2 = 2.5, which is a float.
10 // 3 = 3 (floor division), 10 % 3 = 1 (modulo). 3 + 1 = 4. Wait, let me recalculate: 10//3=3, 10%3=1, so 3+1=4. Actually: output is 4.
Variable names cannot start with a digit. '2nd_variable' is invalid because it begins with '2'. Valid names start with a letter or underscore.
The floor division operator (//) returns the quotient without decimal places. 10 // 3 = 3.
The append() method adds an element to the end of a list. insert() requires index specification, add() is for sets.
String concatenation using + operator combines 'Hello', ' ', and 'World' into 'Hello World'.