Dictionary comparison — method?
Use `==` for equality; `cmp()` in Python 2.
keys() — returns?
A view object of all dictionary keys.
dict() — creates?
A dictionary from sequences of key-value pairs.
KeyError — when?
Accessing a non-existent dictionary key.
String format() — purpose?
Insert variables into strings dynamically.
!r and !s — in format?
Control object representation: repr() vs str().
String repetition — operator?
The `*` operator repeats strings.
String slicing — syntax?
[start:stop:step] to extract substrings.
count() — does?
Counts occurrences of a substring in a string.
replace() — does?
Replaces substrings within a string.
open() — mode?
Specifies file access: 'r', 'w', etc.
read(n) — reads?
n characters from an open file.
readline() — reads?
A single line from a file.
try-except-else — purpose?
Handle exceptions during file operations.
Python file modes?
'r' for read, 'w' for write, 'b' for binary.
Python data types?
Int, float, string, list, tuple, dict.
Mutable data structure?
List and dict are mutable; tuple is immutable.
Set — characteristics?
Unordered, unique elements, supports set operations.
Variables — rules?
Start with letter/underscore, case-sensitive.
Functions — define with?
Using `def` keyword, reusable code blocks.
Testez vos connaissances avec un QCM de 10 questions sur 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?
Révisez le cours complet dans la fiche de révision de Python Data Handling and String Formatting.
Voir la fiche →Bases de données
Bases de données
Programmation
Programmation
Importe ton cours et l'IA génère des flashcards en 30 secondes.
Générateur de flashcards