+ 5
What is the mistake in this code?
It gives output as none... queue = ['John', 'Amy', 'Bob', 'Adam'] a=input() print(queue.append(a))
7 ответов
+ 7
What are you trying to print? Input or queue?
queue.append( a )
print( queue )
+ 7
Riya ,
here a short explanation why your code prints *None*.
<list>.append() is adding a new element at the end of the list. this is done in place, this means no new list is created. all functions that are working in place do not give a return value. in this case *None* is printed.
+ 6
Thank you I got the output
+ 4
Thank you Lothar nice explanation 👍
+ 2
When i tried this code, it didn't work
context.rect(50,50,100,50);
context.stroke();
0
Well u cant access a variable that you deklarate just in the moment, like my foreposters already said: first apply the value THAN read the value.