Deprecated: Return type of WPCF7_FormTag::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/form-tag.php on line 396
Deprecated: Return type of WPCF7_FormTag::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/form-tag.php on line 388
Deprecated: Return type of WPCF7_FormTag::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/form-tag.php on line 382
Deprecated: Return type of WPCF7_FormTag::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/form-tag.php on line 400
Deprecated: Return type of WPCF7_Validation::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/validation.php on line 78
Deprecated: Return type of WPCF7_Validation::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/validation.php on line 72
Deprecated: Return type of WPCF7_Validation::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/validation.php on line 59
Deprecated: Return type of WPCF7_Validation::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/cscircles/dev/www/wordpress/wp-content/plugins/contact-form-7/includes/validation.php on line 82 15B: Übungen | Computer Science Circles
[Learn Python the Easy Way]
15B: Übungen
Die Aufgaben 15A, 15B, und 15C können in beliebiger Reihenfolge bearbeitet werden.
In dieser Lektion geben wir einige Aufgaben mittlerer Größe, die Techniken kombinieren, die wir in früheren Lektionen gelernt haben.
Verwende bitte in der nächsten Übung die Methoden string.split(), das die Leerzeichen eines Wortes entfernt und eine Liste derjenigen Worte ausgibt, die es enthält und string.lower(), das eine Zeichenkette zu Kleinbuchstaben umwandelt. Zum Beispiel.
"Split these words!".split() gibt die Liste aus ["Split", "these", "words!"]
"LOWERCase".lower() ergibt "lowercase"
Achtung: split() kann weitere Möglichkeiten akzeptieren, um andere Auftrennungen vorzunehmen, siehe dazu auch die Dokumentation.
Nimm an, du hast n Geschmacksrichtungen von Eiscreme und möchtest einen Eisbecher zusammenstellen, der genau k dieser Geschmachsrichtungen enthält. Wie viele unterschiedliche Geschmacksrichtungen sind möglich? Zum Beispiel, wenn n=4 und k=2, gibt es 6 Möglichkeiten:
(1) A und B, (2) A und C, (3) A und D, (4) B und C, (5) B und D, (6) C und D.
(in diesem Beispiel könnten die Geschmacksrichtungen zum Beispiel Aprikose, Blaubeere, Cookie und Dattel sein).
Auf die selbe Art und Weise könntest du 2 Leute aus einer Gruppe von 4 auswählen (Al, Bob, Carol, Di) um ein Komitee zusammenzustellen. Auf wieviele Arten und Weisen kann das Komitee gebildet werden? Die Antwort wäre immer noch 6. Die nächste Aufgabe dreht sich um die Berechnung dieser Zahl.
In der Mathematik wird die Zahl, die du gerade berechnet hast, folgendermaßen geschrieben:
und wird genannt "n choose k." Es gibt viele interessante Fakten über diese Werte, wie zum Beispiel
und
Dies ist das Ende unserer Übung, du kannst weitergehen zu einer anderen Lektion.