{"id":1811,"date":"2023-09-26T19:45:53","date_gmt":"2023-09-26T19:45:53","guid":{"rendered":"https:\/\/www.sorumatix.com\/blog\/?p=1811"},"modified":"2023-09-26T19:45:53","modified_gmt":"2023-09-26T19:45:53","slug":"dongu-yapisi-ile-problem-cozme","status":"publish","type":"post","link":"https:\/\/www.sorumatix.com\/blog\/dongu-yapisi-ile-problem-cozme.html","title":{"rendered":"D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zme"},"content":{"rendered":"<p><center><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/EwZLLg676B8\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/center><html><head><\/head><body><\/p>\n<p>Nas\u0131l D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zebilirsin?<\/p>\n<p>Merhaba! Bu makalede, d\u00f6ng\u00fc yap\u0131s\u0131 ile problem \u00e7\u00f6zme konusunu ele alaca\u011f\u0131z. D\u00f6ng\u00fcler, programlamada s\u0131k\u00e7a kullan\u0131lan ve tekrar eden i\u015flemleri otomatikle\u015ftirmek i\u00e7in harika bir ara\u00e7t\u0131r. \u00d6zellikle yaz\u0131l\u0131m geli\u015ftirme konusunda ilgiliysen, d\u00f6ng\u00fcler senin en iyi dostun olabilir!<\/p>\n<p>D\u00f6ng\u00fc nedir ve ne i\u015fe yarar?<\/p>\n<p>D\u00f6ng\u00fc, belirli bir ko\u015ful sa\u011fland\u0131\u011f\u0131 s\u00fcrece tekrar tekrar \u00e7al\u0131\u015fan bir yap\u0131d\u0131r. Bu, ayn\u0131 kod blo\u011funun birden \u00e7ok kez y\u00fcr\u00fct\u00fclmesini sa\u011flar. Peki, bu ne anlama geliyor? D\u00fc\u015f\u00fcn biraz&#8230; Diyelim ki 100 kere Merhaba! yazd\u0131rmak istiyorsun. Elbette tek tek 100 kez print(&#8216;Merhaba!&#8217;) demek yerine, bir d\u00f6ng\u00fc kullanmak daha mant\u0131kl\u0131 olurdu, de\u011fil mi?<\/p>\n<p>Peki nas\u0131l kullan\u0131l\u0131r?<\/p>\n<p>D\u00f6ng\u00fc yap\u0131s\u0131n\u0131n temelinde bir ba\u015flang\u0131\u00e7 de\u011feri, bir bitirme ko\u015fulu ve bir ad\u0131m sayac\u0131 bulunur. En yayg\u0131n kullan\u0131lan d\u00f6ng\u00fc t\u00fcrleri \u015funlard\u0131r:<\/p>\n<p>1. For D\u00f6ng\u00fcs\u00fc:<\/p>\n<p>For d\u00f6ng\u00fcs\u00fc, belirli bir liste veya dizideki her bir \u00f6\u011fe \u00fczerinde dola\u015fmak i\u00e7in kullan\u0131l\u0131r. E\u011fer belirli bir say\u0131da tekrar yapmak istedi\u011fin i\u015flem varsa, for d\u00f6ng\u00fcs\u00fc senin i\u00e7in bi\u00e7ilmi\u015f kaftan!<\/p>\n<p>\u00d6rne\u011fin, renk adl\u0131 bir liste olu\u015fturdu\u011funu d\u00fc\u015f\u00fcnelim. Bu listeyi kullanarak t\u00fcm renkleri yazd\u0131rmak i\u00e7in for d\u00f6ng\u00fcs\u00fcn\u00fc kullanabilirsin:<\/p>\n<p>&#8220;`python<\/p>\n<p>renkler = [k\u0131rm\u0131z\u0131, mavi, ye\u015fil]<\/p>\n<p>for renk in renkler:<\/p>\n<p>print(renk)<\/p>\n<p>&#8220;`<\/p>\n<p>Bu basit \u00f6rnekte, renkler listesindeki her bir \u00f6\u011fe \u00fczerinde dola\u015f\u0131yoruz ve her birini ayr\u0131 ayr\u0131 yazd\u0131r\u0131yoruz.<\/p>\n<p>2. While D\u00f6ng\u00fcs\u00fc:<\/p>\n<p>While d\u00f6ng\u00fcs\u00fc, belirli bir ko\u015ful sa\u011fland\u0131\u011f\u0131 s\u00fcrece \u00e7al\u0131\u015f\u0131r. Bu ko\u015ful yanl\u0131\u015f hale geldi\u011finde d\u00f6ng\u00fc sonlan\u0131r. Bir i\u015flemi belirli bir durum ger\u00e7ekle\u015fene kadar tekrarlamak istiyorsan while d\u00f6ng\u00fcs\u00fc seni amac\u0131na ula\u015ft\u0131r\u0131r!<\/p>\n<p>\u00d6rne\u011fin, kullan\u0131c\u0131n\u0131n girdi\u011fi say\u0131lar\u0131 toplayan bir program yazmak istedi\u011fini d\u00fc\u015f\u00fcnelim. \u0130\u015fte nas\u0131l yapabilece\u011fin:<\/p>\n<p>&#8220;`python<\/p>\n<p>toplam = 0<\/p>\n<p>sayi = 1<\/p>\n<p>while sayi != 0:<\/p>\n<p>sayi = int(input(Bir say\u0131 girin (\u00c7\u0131kmak i\u00e7in 0&#8217;a bas\u0131n): ))<\/p>\n<p><center><img decoding=\"async\" src=\"https:\/\/www.sorumatix.com\/blog\/wp-content\/uploads\/2023\/09\/uploaded-image-dongu-yapisi-ile-problem-cozme-1693815761499.jpg\" title=\"D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zme \" alt=\"D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zme \"><\/center><\/p>\n<p>toplam += sayi<\/p>\n<p><center><img decoding=\"async\" src=\"https:\/\/www.sorumatix.com\/blog\/wp-content\/uploads\/2023\/09\/uploaded-image-dongu-yapisi-ile-problem-cozme-1693815761904.jpg\" title=\"D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zme \" alt=\"D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zme \"><\/center><\/p>\n<p>print(Girdi\u011finiz say\u0131lar\u0131n toplam\u0131:, toplam)<\/p>\n<p>&#8220;`<\/p>\n<p>Bu \u00f6rnekte, kullan\u0131c\u0131 0 tu\u015funa basana kadar program s\u00fcrekli olarak say\u0131 giri\u015fi yapmas\u0131n\u0131 istiyor ve girilen say\u0131lar\u0131 toplayarak sonucu ekrana yazd\u0131r\u0131yor.<\/p>\n<p>D\u00f6ng\u00fclerle problem \u00e7\u00f6zme becerinizi geli\u015ftirmek i\u00e7in pratik yapmay\u0131 unutmay\u0131n. Programlamada d\u00f6ng\u00fc yap\u0131s\u0131n\u0131n temelini anlad\u0131\u011f\u0131n\u0131zda, daha karma\u015f\u0131k problemleri bile kolayca \u00e7\u00f6zebilirsiniz.<\/p>\n<p>Umar\u0131m bu makale d\u00f6ng\u00fc yap\u0131s\u0131 ile problem \u00e7\u00f6zme konusunda sana yard\u0131mc\u0131 olur. Ba\u015far\u0131lar dilerim ve kodlama yolculu\u011funda e\u011flenceli bir \u015fekilde ilerlemen dile\u011fiyle!<\/p>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nas\u0131l D\u00f6ng\u00fc Yap\u0131s\u0131 \u0130le Problem \u00c7\u00f6zebilirsin? Merhaba! Bu makalede, d\u00f6ng\u00fc yap\u0131s\u0131 ile problem \u00e7\u00f6zme konusunu ele alaca\u011f\u0131z. D\u00f6ng\u00fcler, programlamada s\u0131k\u00e7a<\/p>\n","protected":false},"author":1,"featured_media":1804,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[14],"tags":[],"class_list":["post-1811","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bilgisayar-bilimleri-dersleri"],"_links":{"self":[{"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/posts\/1811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/comments?post=1811"}],"version-history":[{"count":0,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/posts\/1811\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/media\/1804"}],"wp:attachment":[{"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/media?parent=1811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/categories?post=1811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sorumatix.com\/blog\/wp-json\/wp\/v2\/tags?post=1811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}