Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively
[1:4] slices from index 1 to 3 (exclusive), returning ‘ytho’.
startswith() checks if a string begins with a specified prefix, e.g., ‘Python’.startswith(‘Py’) is True.
strip() removes leading and trailing whitespace, resulting in ‘text’.
The + operator concatenates strings, e.g., ‘Hello’ + ‘World’ becomes ‘HelloWorld’.
len(‘Python’) returns 6, counting all characters including the last ‘n’.
The upper() method converts all characters to uppercase, e.g., ‘python’ becomes ‘PYTHON’.
The + operator joins ‘web’ and ‘dev’ into ‘webdev’.
text[0] accesses the first character ‘P’ using indexing.
Python int has no maximum value, limited only by system memory.
2 ** 4 raises 2 to the power of 4, resulting in 16.