29 августа 2022
York Porkтекст ещё не в индексе
To keep it simple, the identity operator "is" returns True when "id" of both the objects are true.
a = 100
b = 99 + 1
Now check id(a), id(b) ... If they are the same then a is b return True else False.
is and is not are used to check the identity of the object but not the data.
David BuenoGreetings, today I started the challenge, I'm on day 1. But I don't get the button to run the code
You can press ctrl + shift + p and search for "run" in the opened panel. There should be a result that says "run python file in terminal" or sth like this. Select that and your program will be run.
Or you can manually run it with terminal
I CL1=[1,2,3,4,5,6] print(L1[L1[L1[L1[1]+1]]])
Why ans 6 ?
L[1] = 2 so L[1] + 1 = 3
L[L[1] + 1] = L[3] = 4
L[L[L[1] + 1]] = L[L[3]] = L[4] = 5
L[L[L[L[1] + 1]]] = L[5] = 6
Hope this helps
I CL1=[1,2,3,4,5,6] print(L1[L1[L1[L1[1]+1]]])
Why ans 6 ?
I think you prolly forgot that list index starts with 0 not 1
Nanba MTo keep it simple, the identity operator "is" returns True when "id" of both the objects are true.
a = 100
b = 99 + 1
Now check id(a), id(b) ... If they are the same then a is b return True else False.
is and is not are used to check the identity of the object but not the data.
Understood, many thanks for clarifying their usage for me 😄
id 1353347414what is the actual difference between set.update() and set.union() both showing same output
Update would update the existing set while union would return the new set.