Govt. Exams
Entrance Exams
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'.
Python uses the hash symbol (#) for single-line comments. The other syntaxes are used in other programming languages.
int(num) converts the string '123' to the integer 123. The result is an integer type.
The string 'India' has 5 characters (I, n, d, i, a), so len('India') returns 5.
5.0 is a floating-point number, so type(5.0) returns <class 'float'>.
Tuples are immutable in Python, meaning their elements cannot be changed after creation. Lists, dictionaries, and sets are all mutable.