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 8: Remix | Computer Science Circles
[Python for Students and Teachers]
8: Remix
Bu derste, daha önceki derserde edindiğimiz becerileri birleştirerek kullanacağımız bazı alıştırmalar yapacağız.
Şimdiki soruda, sorunun cevabını doğru yazdırdığınızda * işaretleri ile cevabınızın grafik görselini vereceğiz.
Bunun için bir for döngüsü yazarak stingin içinde yer alan + karakterini arayabilir, ardından + işaretinden önceki ve sonraki substringleri alıp onları int tipine değiştirerek toplayabilirsiniz.
Artı işaretini bulmak için for char in S: formülünü de kullanabilirsiniz ama bu yöntemle toplamak istediğimiz substringleri almak pek kolay olmayacak. Onun yerine bizim tavsiyemiz rakamsal bir for döngüsü yazmanız;
for position in range(0, len(S)):
bu şekilde daha doğrudan bir yöntemle ilerleyebileceksiniz.
Substringleri kullanarak döngü oluştururken kullanmamız gereken önemli araç == işareti olacak, ki substringlerin aynı olup olmadığını kontrol edebilelim.
Uzunluğu L olan bir input için sağ tarafa (uzunluk-L)//2 sayıda nokta eklemelisiniz.
Python Adder'da (toplayıcı) yaptığımız gibi inputu saat ve dakikalara bölelim.
Başlangıç zamanı H saat ve M dakika olduğunda, son süre (M+D) % 60 olacak. // 60 ve % 24 işlemlerini doğru şekilde yaptığımızda son süreyi hesaplayabileceğiz.