In: Computer Science
In Python, suppose you had:
>>> a_name = 'Byb'
Then is this legal?
>>> a_name[1] = 'o'
If not why not?
Answer: The statement a_name[1] = 'o' is not a legal statement.
Explanation: a_name = 'Byb' indicates string object.But a_name[1] = 'o' indicates list item.In python lists are declared as fruits = ['apple','banana'] ,the second statement is legal when such type of list is declared in the code.
code: