qertsavvy.blogg.se

.ipynb viewer
.ipynb viewer









.ipynb viewer

pop ()) print ( "After pop() ", l1 ) # del operator deletes an element from a specified index or a slice del l1 print ( "After del ", l1 ) # list.clear() - removes all items from the list. # removes the item at a given position # list.pop() removes and returns the last item in the list print ( l1.

.ipynb viewer

remove ( 3 ) print ( "After remove ", l1 ) # list.pop() - passing the parameter is optional and hence written within. insert ( 4, 5 ) print ( "After insert ", l1 ) # list.remove(x) - removes first item from the list whose value is equal to x. extend ( range ( 6, 10 )) print ( "After extend ", l1 ) # list.insert(i, x) - i is the index value and x is the data to insert l1. append ( 4 ) print ( "After append ", l1 ) # list.extend(iterable) - extends the list by appending all the items from the iterable l1.

.ipynb viewer

# list.append(x) - adds to the end of the list l1 = l1. Writing the value None is normally suppressed by the interpreter if it would be the only value written. This value is called None (it’s a built-in name). In fact, even functions without a return statement do return a value, albeit a rather boring one.The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is called thus, arguments are passed using call by value (where the value is always an object reference, not the value of the object).The execution of a function introduces a new symbol table used for the local variables of the function.The first statement of the function body can optionally be a string literal this string literal is the function’s documentation string, or docstring like """This function parses JSON""".The statements that form the body of the function start at the next line, and must be indented. It must be followed by the function name and the parenthesized list of formal parameters. The keyword def introduces a function definition.











.ipynb viewer