Govt. Exams
Entrance Exams
The + operator concatenates strings in Python. Other operators don't perform string concatenation.
The len() function counts all characters including the space. 'hello world' has 11 characters (including 1 space).
Tuples are immutable, meaning their elements cannot be changed after creation. Lists, dictionaries, and sets are mutable.
The floor division operator (//) returns the quotient rounded down to the nearest integer. 10 // 3 = 3.
String slicing [2:5] extracts characters from index 2 to 4 (5 is exclusive). 'Python'[2:5] = 'yth'.
The 'def' keyword is used to define a function in Python. Other options are not valid Python keywords.
The division operator (/) in Python 3 always returns a float, even if both operands are integers.
Python comments start with # and can appear anywhere. Multi-line comments use triple quotes or multiple # symbols.
The string 'Python' has 6 characters: P, y, t, h, o, n. The len() function returns the number of characters.
The 'def' keyword is used to define functions in Python. It is followed by the function name and parameters.