Tarjetas de memoria: Python Data Handling and String Formatting — 20 tarjetas

Todas las tarjetas

1Pregunta

Dictionary comparison — method?

Respuesta

Use `==` for equality; `cmp()` in Python 2.

2Pregunta

keys() — returns?

Respuesta

A view object of all dictionary keys.

3Pregunta

dict() — creates?

Respuesta

A dictionary from sequences of key-value pairs.

4Pregunta

KeyError — when?

Respuesta

Accessing a non-existent dictionary key.

5Pregunta

String format() — purpose?

Respuesta

Insert variables into strings dynamically.

6Pregunta

!r and !s — in format?

Respuesta

Control object representation: repr() vs str().

7Pregunta

String repetition — operator?

Respuesta

The `*` operator repeats strings.

8Pregunta

String slicing — syntax?

Respuesta

[start:stop:step] to extract substrings.

9Pregunta

count() — does?

Respuesta

Counts occurrences of a substring in a string.

10Pregunta

replace() — does?

Respuesta

Replaces substrings within a string.

11Pregunta

open() — mode?

Respuesta

Specifies file access: 'r', 'w', etc.

12Pregunta

read(n) — reads?

Respuesta

n characters from an open file.

13Pregunta

readline() — reads?

Respuesta

A single line from a file.

14Pregunta

try-except-else — purpose?

Respuesta

Handle exceptions during file operations.

15Pregunta

Python file modes?

Respuesta

'r' for read, 'w' for write, 'b' for binary.

16Pregunta

Python data types?

Respuesta

Int, float, string, list, tuple, dict.

17Pregunta

Mutable data structure?

Respuesta

List and dict are mutable; tuple is immutable.

18Pregunta

Set — characteristics?

Respuesta

Unordered, unique elements, supports set operations.

19Pregunta

Variables — rules?

Respuesta

Start with letter/underscore, case-sensitive.

20Pregunta

Functions — define with?

Respuesta

Using `def` keyword, reusable code blocks.

Ponte a prueba con el cuestionario

Pon a prueba tus conocimientos con 10 preguntas sobre Python Data Handling and String Formatting.

1. How do you create a Python dictionary from a list of key-value pair tuples?

2. What is the purpose of the 'cmp()' function in Python 2 when used with dictionaries?

Realiza el cuestionario →

Lee la hoja de repaso

Revisa el curso completo en la hoja de repaso para Python Data Handling and String Formatting.

Ver hoja de repaso →

Similar courses

Crea tus propias tarjetas de memoria

Importa tu curso y la IA genera tarjetas de memoria en 30 segundos.

Generador de tarjetas de memoria