caja 1 diccionarios Flashcards

1
Q

eliminar claves(3)

A

.pop(key), .popitem(), del diccionario[clave]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

2 metodos para acceder a los valores de un diccionario, explica get

A

diccionario[key], .get(key,value) si la clave no existe y no pusiste un valor te retorna ‘none’ de lo contrario retorna el valor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

agregar items a un diccionario (3)

A

.update.({}), .setdefault(key, value) ‘clave no debe de existir’, diccionario[new key]= valor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

remplazar el valor de una clave

A

diccionario[key]= value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

crear diccionarios (sintaxis)

A

name_dict= dict.fromkeys(sequence, value)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

keys(), values(), items()

A

devuelven las llaves, valores, o items de un diccionario en una lista de tuplas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly