home scroll python

Language Reference

Create two dimensional array

w, h = 8, 5
Matrix = [[0 for x in range(w)] for y in range(h)]
Matrix[0][0] = 1
https://stackoverflow.com/questions/6667201/how-to-define-a-two-dimensional-array

Slicing arrays, lists, and strings

Syntax:
collection[start:stop:step]
Examples:
my_array[1:4]
returns the first three elements of my_array.
my_array[::2]
returns every other element of my_array.
my_array[:-10]
returns every element of my_array, except the last 10 elements.

Accessing the index in 'for' loops

xinput = [Value(x, type="i%s" % index) for index, x in enumerate(xinumbers, start=1)]
https://stackoverflow.com/questions/522563/accessing-the-index-in-for-loops

Ordered Sets

By default, sets are unordered
thisset = {"apple", "banana", "cherry"}
print(thisset)
{'cherry', 'banana', 'apple'}
https://www.w3schools.com/python/python_sets.asp

Category

git Usage

Single Board Computers

Follow Me

discord