Python Unit 7 - Lists & Dictionaries

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

dictionary

A dictionary is a set of elements where each element is a key-value pair.

key

A key is a value in a dictionary that can be used to retrieve a matching, corresponding value.

list

A list is a set of elements where each element has a corresponding index position.

value

A value is stored in a dictionary and that can be accessed with a corresponding key.

element

An element is a specific value within a list.

append method

The append method adds a new element to the very end of a list.

clear method

The clear method empties all elements from a dictionary.

list concatenation operator

The concatenation operator for lists is the plus symbol ( + ). It can be used to join two lists together.

del statement

The del statement removes an element from a list.

extend method

The extend method adds a list to another list.

index method

The index method returns an element in a list with a given index position.

indexing operator

The indexing operator in Python is square brackets ( [ ] ). The indexing operator is used to specify a single element with a corresponding number.

insert method

The insert method adds a new element to a specified index position within a list.

keys method

The keys method is used to create a list of all keys in a dictionary.

len function

The len function returns the number of elements in a list.

pop method

The pop method removes an element from a list.

remove method

The remove method removes an element from a list.

sort method

The sort method puts elements of a list in a ranked order.

values method

The values method is used to create a list of all values in a dictionary.


Set pelajaran terkait

BUS Ch 7 COGS, LIFO, FIFO and Ch 8 reporting PPE and Intangibles

View Set

Geography Chapter 2, Section 7 Review-A beka

View Set

Ch. 1 - A Framework for Financial Accounting - Learning Objectives

View Set

Lecture 24: Intro/Framework for Psych Nursing

View Set