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 08: Van alles wat | Computer Science Circles
[Free Online Python Course]
08: Van alles wat
Deze les bestaat uit een aantal oefeningen waarin de verschillende vaardigheden aan bod komen, die je in de voorgaande lessen hebt geleerd.
Bij de volgende vraag, zullen we, zodra je ze correct hebt opgelost, je een grafische representatie laten zien van de uitvoer waarbij we het *-teken gebruiken als grafisch element.
Gebruik een for-lus om het +-teken in de string te vinden, en bepaal dan de substrings voor en na de +. Bewerk ze tot een int en tel ze op.
Je kan for char in S: gebruiken om naar het plusteken te zoeken, maar dan moet je een truukje uithalen om ook de positie van het plusteken te bepalen. We bevelen aan een numerieke for-lus te gebruiken, zoals bij
for position in range(0, len(S)):
wat tot een eenvoudigere oplossing leidt.
Bij een invoer van lengte L, moet je (breedte-L)//2 punten ter rechterzijde afdrukken.
Verdeel de invoer in uren en minuten en gebruik dezelfde truc als in Python-optelprogramma.
wanneer de originele tijd H uren is en M minuten, dan is het aantal minuten (M+D) % 60. Om het aantal uren te bepalen zijn // 60 en % 24 te gebruiken.