Chapter 6

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

IndexError.

Accessing an index that is out of range causes the program to automatically abort execution and generate an ________

index

An _______ is an integer corresponding to a specific position in the list's sequence of elements.

stride

An optional component of slice notation is the , which indicates how many elements are skipped between extracted items in the source list.

nested for loops.

As always with lists, a typical task is to iterate through the list elements. A programmer can access all of the elements of nested lists by using _____________

key

Both the list.sort() method and the built-in sorted() function have an optional ____ argument.

are values entered by a user when running a program from a command line.

Command-line arguments

usage message

If the number of arguments is incorrect, the program prints an error message, referred to as a ____________, that provides the user with an example of the correct command-line argument format.

multi-dimensional data structure,

List nesting allows for a programmer to also create a _____________ the simplest being a two-dimensional table, like a spreadsheet or tic-tac-toe board.

for loop

Looping through a sequence such as a list is so common that Python supports a construct called a________, specifically for iteration purposes.

reverse

Sorting also supports the _______argument. The ________ argument can be set to a Boolean value, either True or False.

list nesting.

Such embedding of a list inside another list is known as _______

In-place modification.

Such growing and shrinking capability is called _______

list comprehension,

The Python language provides a convenient construct, known as _________, that iterates over a list, modifies each element, and returns a new list consisting of the modified elements.

dict

The _____ type implements a dictionary in Python.

enumerate()

The built-in_________ function iterates over a list and provides an iteration counter.

inp.split().

The third row of the table above has an expression in place of the iterable object component of the list comprehension, ______

list()

The_____ function accepts a single iterable object argument, such as a string, list, or tuple, and returns a new list object.

list

The_____ object type is one of the most important and often used types in a Python program.

sort()

_______, which performs an in-place rearranging of the list elements, sorting the elements from lowest to highest.

hash

A __________ is a transformation of the key into a unique value that allows the interpreter to perform very fast lookup

view object

A __________ provides read-only access to dictionary keys and values.

data structure

A ___________ is a method of organizing data in a logic and coherent fashion.

list method

A ________________ can perform a useful operation on a list such as adding or removing elements, sorting, reversing, etc.

nested dictionaries,

A dictionary may contain one or more __________ in which the dictionary contains another dictionary as a value.

dictionary method

A is a function provided by the dictionary type (dict) that operates on a specific dictionary object

Container

A list is a _________, which is an object that groups related objects together.

slice notation

A programmer can use ______ to read multiple elements from a list, creating a new list that contains only the desired elements.

mutable

a list is ________ and is thus able to grow and shrink without the program having to replace the entire list with an updated copy.

dictionary comprehension,

which evaluates a loop to create a new dictionary, similar to how list comprehension creates a new list.

sys.argv

which is stored in the standard library sys module._______consists of one string element for each argument typed on the command line.


Ensembles d'études connexes

Legal Environment of Business Unit 1 Test

View Set

marketing ch.9, marketing ch.10, marketing ch.12

View Set

Salesforce Marketing Cloud Admin Test 2

View Set

2: Solutions 2.01: Solutions: Wiva k12 Chemistry

View Set

Advance auto parts Emissions assessment

View Set

Life and Health Insurance Final Exam

View Set

Data Analyst Interview Questions: Basic

View Set

Chapter 14: Agency and the Employment Relationship

View Set

AWS Cloud Practitioner Practice Exam 2

View Set

COSC 1301 INTRO TO COMPUTERS MOD 4 -5

View Set