All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Append Integer to Beginning of List in Python

In Python, there are 2 ways to append integer to beginning of list. Using insert Method The list.insert() method inserts an item at a given position. The first argument is the index of the element before which to insert. For example, #!/usr/bin...
pooriabt

How to Return Dictionary Keys as a List in Python

In Python, there are 3 ways to return dictionary keys as a list. Using keys Function The dict.keys() function returns a view object that displays a list of all the keys in the dictionary in order of insertion. See the following example: #!/usr/...
Sambhav Khandelwal

How to Copy a Dictionary in Python

In Python, there are 4 ways to copy a dictionary. Using dict Method If you want to copy the dict, you have to do so explicitly with: #!/usr/bin/python3 a = {"a": 1, "b": 2} # Copy b = dict(a) b['a'] = 3 print(a) print(b) {'a': 1, 'b': 2} {'...
Patcher56

How to Unpack Array as Arguments in Go

In Golang, there are 2 ways to unpack array as arguments. Using Variadic Functions Variadic functions can be called with any number of trailing arguments. Here’s a function that will take an arbitrary number of ints as arguments. For example, p...
Unused

How to Merge two Dictionaries into a new Dictionary in Python

In Python, there are 3 ways to merge two dictionaries into a new dictionary. Using Additional Unpacking Generalizations Starting with Python 3.5, we can merge in with literal notation as well. See the following example: #!/usr/bin/python3 # -*-...
Unused

How to use the go clean command line

Remove object files and cached files. Clean removes object files from package source directories. The go command builds most objects in a temporary directory, so go clean is mainly concerned with object files left by other tools or by manual invocati...