![]() |
VOOZH | about |
Prerequisite:
LoopsNote:
Output of all these programs is tested on Python3
Output:
2. [‘geeks’, ‘forgeeks’]
Explanation:
The function
upper()
does not modify a string in place, it returns a new string which isn’t being stored anywhere.
Output:
4. None of these
Explanation:
The loop does not terminate as new elements are being added to the list in each iteration.
Output:
1. 1 2 3 4 5 6
Explanation:
The loop will terminate when
i
will be equal to 7.
Output:
3. Error
Explanation:
SyntaxError,
True
is a keyword and it’s value cannot be changed.
Output:
3. Syntax Error
Explanation:
SyntaxError, there shouldn’t be a space between + and = in
+=
.