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 2X: Alıştırmalar | Computer Science Circles
[Distance Education in Python]
2X: Alıştırmalar
Bu derste bazıları size biraz zor gelebilecek alıştırmalar bulunuyor. Eğer takılırsanız, bir sonraki probleme veya derse geçmenizde hiçbir sakınca yok, daha sonra gelip tekrar deneyebilirsiniz. Daha önce yapmış olduğunuz alıştırmalara göz atmak için İlerleme sayfası her zaman elinizin altında.
İlk alıştırmamız hata ayıklama alıştırması. Nüfus artışının pek de doğru hesaplanamadığı bir formül kullanılmaya çalışılıyor.
Bu dersteki diğer alıştırmalar min ve max fonksiyonları ile ilgili.
Karmaşık bir ifadeyi basitleştirme
Multiple Choice Exercise: Basitleştirme
Aşağıdaki ifadeyi nasıl basitleştirebiliriz?
max(x - 3, min(x + 10, x + 5))
Doğru! Çünküx + 5 işleminin sonucu her zaman x + 10, işleminden küçük olacaktır. min(x + 10, x + 5) işlemini sadece x + 5 olarak ifade edebiliriz. Dışa doğru çıktığımızda tüm işlem max(x - 3, x + 5) şeklinde. Bu iki rakamdan en büyüğü her zaman x + 5 olacağı için sonuç da budur.
Basit bir ifadeyi karmaşıklaştırma
Ödeme Hesaplayıcı
Karmaşayı Düzenleme
Son problem, rakamları farklı bir şekilde sıralamanızı (sorting) isteyeceğimiz zor bir soru olacak. Daha iyi, daha basit ve daha hızlı sıralama yöntemleri ( sorting methods ) var. Bu başlangıç derslerini tamamladıktan sonra bu yöntemler hakkında bilgi edinmenizi tavsiye ederiz.
Eğer takılırsanız, problemi daha sonra çözmek üzere bırakın. Daha sonra gelip tamamlarsınız. İlerleme sayfanıza giderek bitirdiğiniz derslerdeki hangi alıştırmaları tamamladığınızı, hangilerini tamamlamadığınızı görebilirsiniz.
3. derse devam!
Şaşırtmacalı bir problem. Başlangıç olarak sadece bir yılı düşünün. Yıllık %10 artışla bir yıl sonraki nüfus kaç olur? Yeni eklenen kişi sayısı 1000 kişide %10 = 0.1 * 1000 = 100. Yani bir yıl içinde total (orijinal + yeni) = 1100. Fakat program örneği bir yıl için bile hatalı:
Doğru çıktı 1100.0 olmalıydı ama yanlış olarak 100.0 sonucunu veriyor. İkinci satırda bir karakteri değiştirdiğinizde sonucun 100 yerine 1100 (toplam) olacağını görüyor musunuz?
max(-A, -B) nedir?
min(A, B)+max(A, B) nedir?
Problemi ikiye bölün. İlk olarak bakiyenin balance0.021 ile çarpımının maksimumunu ve 10 hesaplayın. Bu bakiyenin aşılmadığı durumun işlemi olacak. Sonra bir şekilde min kullanın.
This code uses a particular strategy which affects the pair (x, y) first, then (y, z), then (x, y) again.