• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/20

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

20 Cards in this Set

  • Front
  • Back

What type of data are lists?

Collections

What types of collections do you know?

Tuples, lists and dictionaries

What do you call the values inside of the brackets?

Items or elements

What brackets do lists have?

a = [1, 2]

What can lists contain?

All types of variables, even other lists (nested lists)

Can lists be empty?

Yes

What does ordered mean for lists?

Every element was allocated a certain position in memory, so called indices

How can you access indices of lists?

Using the index operator


a = [1, 2, 3]


print(a[1])


## 2

Are lists mutable?

Yes

Can lists be used as dictionary keys?

No because they are mutable

How to add a new element to a list in a non existent index?

Use a.append(2) for example to add one specific element at the end of the list.


Use a.extend(1, 2) to add multiple values to your list

What are Tuples

Ordered collections but less extensively functional and immutable

What brackets are used for Tuples

a = (1, 2)

How to change a Tuple

Tuple2 = (Tuple1 + "New_Name")


Copy the only Tuple, add a new element and assign it to a new Tuple

What are dictionaries?

Unordered collections of key:value pairs separated by a comma that are mutable

Keys

You cannot map the same keys to several values, will be overridden

Keys are immutable

Lists cannot be Keys, neither can dictionaries because they are mutable

How can you assess values if dictionaries are Unordered?

Using the keys. You can access and change them.


Print(key_1[0])

What brackets do dictionaries have?

a = {1, 2}

How do you remove a dictionary entry?

Del statement