Sobes.tech
Intern — Senior

String modification inside a loop

livecode

Task condition

In the given fragment of Python code, an attempt is made to change the characters of the string 'python' during iterations. What will be the output? Answer options:

  • error
  • Python
  • PYTHON
  • python
txt = 'python'
for i in range(len(txt)):
    txt[i].upper()
print(txt)