Python

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/6

encourage image

There's no tags or description

Looks like no tags are added yet.

7 Terms

1
New cards

How to open a file in order to write to it

file = open(“FILE.txt”, “w”)

2
New cards

How to loop over an array with the index [i]

for i in range(len(array)):

print(array[i])

3
New cards

What is the length of a 2D array

The number of rows

4
New cards

How does integer division work?

It rounds down/floors

5
New cards

How do you get the number of columns in a 2D array

numberOfColumns = len(row)

6
New cards

How to loop through every item in a 2D array row by row

for row_i in range(len(array)):

for col_i in range(len(array[row_i])):

print(array[row_i][col_i])

7
New cards

How to loop through every item in a 2D array column by column

for col_i in range(len(array[0])):

for row_i in range(len(array)):

print(array[row_i][col_i])