List=[1,'hi',[2,3,['bye']]]
List [2][2][0]='hi'
print(List)
Why does hi replace bye,explain ,please?
List=[1,'hi',[2,3,['bye']]]
List [2][2][0]='hi'
print(List)
Why does hi replace bye,explain ,please?
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
How much do you know about arrays (or “lists”), specifically multi-dimensional (or “nested”) ones?
List index’s start at 0.
in your case,
List[0] == 1
List[1] == 'hi'
You may find this useful for visualise your code: http://pythontutor.com/