Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively
Floor division // with floats returns 3.0, the integer part as a float.
+= 1 increments a variable, e.g., x += 1 increases x by 1.
complex(1, 2) creates a complex number 1 + 2j.
The modulo operator % returns the remainder, 5 % 2 = 1.
int() converts a string like ’10’ to an integer, e.g., int(’10’) = 10.
abs(-10) returns 10, the absolute value of -10.
The % operator gives the remainder, applicable in calculations like 7 % 3 = 1.
3 + 2j is a complex number, with a real part 3 and imaginary part 2.
zip([‘a’, ‘b’], [1, 2]) pairs keys and values, creating {‘a’: 1, ‘b’: 2}.
keys() returns a view of all keys, e.g., {‘a’: 1}.keys() = dict_keys([‘a’]).