Back to marketplace

Prompt Engineering 2

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v3•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

What are the two core elements contained within a class definition? / Was sind die zwei Kernelemente, die in einer Klassendefinition enthalten sind?

Back (Answer)

Data (stored via attributes) and Behavior (implemented via methods). / Daten (gespeichert über Attribute) und Verhalten (implementiert über Methoden).

#2
Front (Question)

What is an instance of a class? / Was ist eine Instanz einer Klasse?

Back (Answer)

A concrete object created from a class blueprint that possesses its own isolated state. / Ein konkretes Objekt, das aus dem Bauplan einer Klasse erstellt wurde und einen eigenen, isolierten Zustand besitzt.

#3
Front (Question)

What does ‘self’ represent inside a Python class method? / Was repräsentiert ‘self’ innerhalb einer Python-Klassenmethode?

Back (Answer)

It points directly to the current unique object instance on which the method is being called. / Es verweist direkt auf die aktuelle, spezifische Objektinstanz, auf der die Methode aufgerufen wird.

#4
Front (Question)

What is the primary responsibility of the __init__ constructor method? / Was ist die Hauptaufgabe der __init__-Konstruktormethode?

Back (Answer)

To initialize an instance and establish a valid baseline starting state (invariants). / Eine Instanz zu initialisieren und einen gültigen Ausgangszustand (Invarianten) herzustellen.

#5
Front (Question)

What is a class invariant? / Was ist eine Klasseninvariante?

Back (Answer)

A structural condition or business rule that must always remain true and valid throughout the entire lifetime of an object. / Eine strukturelle Bedingung oder Geschäftsregel, die über die gesamte Lebensdauer eines Objekts hinweg immer wahr und gültig bleiben muss.

#6
Front (Question)

What is the difference between an instance attribute and a class attribute? / Was ist der Unterschied zwischen einem Instanzattribut und einem Klassenattribut?

Back (Answer)

Instance attributes are separate for every unique object; class attributes are shared globally across all instances of that class. / Instanzattribute sind für jedes Objekt separat; Klassenattribute werden global von allen Instanzen dieser Klasse geteilt.

#7
Front (Question)

How are private attributes indicated by convention in Python naming? / Wie werden private Attribute laut Konvention in der Python-Namensgebung gekennzeichnet?

Back (Answer)

By prefixing the attribute name with a single underscore (e.g., self._balance). / Indem dem Attributnamen ein einzelner Unterstrich vorangestellt wird (z. B. self._balance).

#8
Front (Question)

What is the purpose of the @property decorator? / Was ist der Zweck des @property-Decorators?

Back (Answer)

It exposes a method as a read-only virtual attribute, allowing clean access without parentheses. / Er macht eine Methode als schreibgeschütztes, virtuelles Attribut verfügbar, was einen sauberen Zugriff ohne Klammern ermöglicht.

#9
Front (Question)

What target audience is the __str__ magic method intended for? / Für welche Zielgruppe ist die magische Methode __str__ gedacht?

Back (Answer)

End users; it provides a readable, user-friendly textual representation of the object. / Endbenutzer; sie liefert eine gut lesbare, benutzerfreundliche Textdarstellung des Objekts.

#10
Front (Question)

What target audience is the __repr__ magic method intended for? / Für welche Zielgruppe ist die magische Methode __repr__ gedacht?

Back (Answer)

Developers; it provides an unambiguous text representation ideally suited for debugging and logging. / Entwickler; sie liefert eine eindeutige Textdarstellung, die sich ideal für Debugging und Logging eignet.

#11
Front (Question)

What utility decorator automatically generates boilerplate constructor, string, and comparison methods? / Welcher Utility-Decorator generiert automatisch Standardcode für Konstruktoren, Strings und Vergleichsmethoden?

Back (Answer)

The @dataclass decorator from the dataclasses module. / Der @dataclass-Decorator aus dem dataclasses-Modul.

#12
Front (Question)

Why should mutable default arguments (like lists) be avoided in standard constructor parameters? / Warum sollten veränderliche Standardargumente (wie Listen) in Standard-Konstruktorparametern vermieden werden?

Back (Answer)

They are evaluated once at definition time and shared across all instances, causing accidental data cross-contamination. / Sie werden nur einmal zur Definitionszeit ausgewertet und von allen Instanzen geteilt, was zu versehentlichen Datenüberschneidungen führt.

#13
Front (Question)

What design principle suggests that a class should encapsulate data and expose only necessary control methods? / Welches Designprinzip besagt, dass eine Klasse Daten kapseln und nur notwendige Kontrollmethoden offenlegen sollte?

Back (Answer)

Information Hiding or Encapsulation. / Geheimnisprinzip oder Kapselung.

#14
Front (Question)

What is the naming convention for Python classes? / Wie lautet die Namenskonvention für Python-Klassen?

Back (Answer)

PascalCase (e.g., BankAccount). / PascalCase (z. B. BankAccount).

#15
Front (Question)

What is the naming convention for Python attributes and methods? / Wie lautet die Namenskonvention für Python-Attribute und -Methoden?

Back (Answer)

snake_case (e.g., calculate_balance). / snake_case (z. B. calculate_balance).

#16
Front (Question)

What is Polymorphism in object-oriented programming? / Was ist Polymorphie in der objektorientierten Programmierung?

Back (Answer)

The ability to trigger the exact same method call on different objects and have each object execute its own specific behavior. / Die Fähigkeit, denselben Methodenaufruf auf verschiedenen Objekten auszuführen, wobei jedes Objekt sein eigenes, spezifisches Verhalten zeigt.

#17
Front (Question)

What is the core philosophy of ‘Duck Typing’ in Python? / Was ist die Kernphilosophie von ‘Duck Typing’ in Python?

Back (Answer)

‘If it walks like a duck and quacks like a duck, it is a duck’—behavior and methods matter, not the explicit class inheritance. / ‘Wenn es wie eine Ente läuft und quakt, ist es eine Ente’—das Verhalten und die Methoden zählen, nicht die explizite Klassenzugehörigkeit.

#18
Front (Question)

What is a Protocol in Python and what type of checking does it provide? / Was ist ein Protocol in Python und welche Art von Prüfung bietet es?

Back (Answer)

A structural interface definition used for static type checking (compile-time) without forcing class inheritance. / Eine strukturelle Schnittstellendefinition für die statische Typprüfung (Zur Compile-Zeit) ohne Vererbungszwang.

#19
Front (Question)

What does ABC stand for and what is its purpose? / Wofür steht ABC und was ist ihr Zweck?

Back (Answer)

Abstract Base Class; a runtime interface enforcement mechanism that prevents instantiation if abstract methods are missing. / Abstract Base Class; ein Mechanismus zur Laufzeit-Schnittstellenprüfung, der die Instanziierung verhindert, wenn abstrakte Methoden fehlen.

#20
Front (Question)

What decorator must be used to declare a method abstract inside an ABC? / Welcher Decorator muss verwendet werden, um eine Methode innerhalb einer ABC als abstrakt zu deklarieren?

Back (Answer)

The @abstractmethod decorator from the abc module. / Der @abstractmethod-Decorator aus dem abc-Modul.

#21
Front (Question)

What is the difference between explicit inheritance and structural typing (Protocols)? / Was ist der Unterschied zwischen expliziter Vererbung und struktureller Typisierung (Protocols)?

Back (Answer)

Inheritance requires nominal subclassing (is-a relationship); Protocols check if matching methods exist regardless of lineage. / Vererbung erfordert nominale Unterklassenbildung (ist-ein-Beziehung); Protocols prüfen das Vorhandensein passender Methoden unabhängig von der Abstammung.

#22
Front (Question)

What is the function of super() inside an overridden method? / Welche Funktion hat super() innerhalb einer überschriebenen Methode?

Back (Answer)

It delegates the method call to the next class in line according to the Method Resolution Order (MRO). / Es delegiert den Methodenaufruf an die nächste Klasse gemäss der Method Resolution Order (MRO).

#23
Front (Question)

What does MRO stand for in Python inheritance hierarchies? / Wofür steht MRO in Python-Vererbungshierarchien?

Back (Answer)

Method Resolution Order; the deterministic path Python follows to look up attributes and methods. / Method Resolution Order; der deterministische Pfad, dem Python folgt, um Attribute und Methoden nachzuschlagen.

#24
Front (Question)

What attribute can you inspect on a class to see its exact MRO sequence? / Welches Attribut kann man auf einer Klasse inspizieren, um ihre genaue MRO-Reihenfolge zu sehen?

Back (Answer)

The __mro__ attribute (or calling the .mro() method). / Das __mro__-Attribut (oder der Aufruf der .mro()-Methode).