SWEN-123 Lecture Notes - List Comprehension & 2D Lists

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

Flashcards about List Comprehension and 2D Lists in Python.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

parentheses

A tuple is created by enclosing a comma separated list of values between _.

2
New cards

TypeError

Trying to change a value inside a tuple will raise a _ because tuples do not support assignment.

3
New cards

tuple()

The built in _ function can create a tuple from another sequence.

4
New cards

tuple()

The _ function will create a tuple from any sequence.

5
New cards

packer

Open your activities module and add a function called _ that returns at least 4 values of your choice.

6
New cards

list()

Using the built-in _ function that will return any sequence as a list, e.g. a = list(range(10))

7
New cards

list()

Calling the _ function will return any sequence as a list

8
New cards

swapper

Open your activities module and add a new function named _ that declares a parameter for a_list.

9
New cards

[:]

Slicing uses a special operator, _, to create a new list by selecting specific values from an existing list.

10
New cards

start

If _ is omitted, it defaults to 0.

11
New cards

stop

If _ is omitted, it defaults to length.

12
New cards

chunky

Open your activities module and add a new function called _ that declares parameters for a_list and a size.

13
New cards

sort()

Calling the _ function on a list will perform an in- place sort on the values in the list.

14
New cards

sorted()

Calling the _ function will return a sorted copy of the list passed in as a parameter to the function

15
New cards

reverse

Setting the named _ parameter to True will sort the list in reverse order.

16
New cards

comprehension

List _ is a syntactic shortcut that can be used to copy the elements of any sequence into a list.

17
New cards

comprehension

Open your activities module and add a function named _.

18
New cards

2D

A _ list is simply a list of lists.

19
New cards

make_table

Open your activities module and add a new function named _ that declares parameters for rows, columns, and a default value.

20
New cards

tictactoe.py

Create a new Python module in a file named _ and add a function called “make_board” that creates and returns a Tic-Tac-Toe board.

21
New cards

make_move

Open your tictactoe module and add a function called _ that declares a parameter for the board and the current symbol (i.e. "X" or "O")