<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Coders Azerbaijan on Medium]]></title>
        <description><![CDATA[Stories by Coders Azerbaijan on Medium]]></description>
        <link>https://medium.com/@codersazerbaijan?source=rss-a1d75e082e40------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*J4hxjz-87a3i3AQzmuxKnw.png</url>
            <title>Stories by Coders Azerbaijan on Medium</title>
            <link>https://medium.com/@codersazerbaijan?source=rss-a1d75e082e40------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:07:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@codersazerbaijan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tech For Everyone: Bridging the Digital Divide in Azerbaijan’s Remote Villages]]></title>
            <link>https://codersazerbaijan.medium.com/tech-for-everyone-bridging-the-digital-divide-in-azerbaijans-remote-villages-3b41252363ba?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b41252363ba</guid>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Fri, 06 Dec 2024 09:55:06 GMT</pubDate>
            <atom:updated>2024-12-06T09:55:06.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qAJiB9iw_fnqL-7qpd5VkQ.jpeg" /></figure><p><strong>Tech For Everyone: Empowering Future Leaders Through Technology</strong></p><p>In a rapidly evolving world, access to technology and the skills to leverage it have become essential for personal and professional growth. At <a href="https://coders.edu.az/"><strong>Coders Azerbaijan</strong></a>, we believe that innovation and opportunity should know no boundaries. That’s why, with the invaluable support of the <a href="https://www.idda.az/"><strong>Innovation and Digital Development Agency</strong></a>, we embarked on an extraordinary journey to implement the <strong>Tech For Everyone</strong> social project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*US6SvhUVXgqNjFOM_b7BNQ.jpeg" /></figure><p><strong>Bringing Technology to the Most Remote Corners</strong></p><blockquote>Our mission was clear: to inspire and educate young minds in the most remote villages of Azerbaijan. For this project, we visited <strong>Khinalig (Guba)</strong>, <strong>Arigiran (Gedebey)</strong>, and <strong>Bash Dashagil (Oguz)</strong> — villages often untouched by technological advancements. These locations are known for their breathtaking landscapes, but they also symbolize the untapped potential of their youth.</blockquote><p>Through this initiative, we engaged with over 50 students, introducing them to the limitless possibilities of careers in technology, the profound impact of artificial intelligence, and the dynamic startup ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbmSr3gLaiMWsE9Jb6KHLA.jpeg" /></figure><p><strong>Unlocking Potential Through Practical Learning</strong></p><p>Our training sessions were more than just lessons; they were experiences designed to spark curiosity and ignite a passion for technology. By combining theoretical knowledge with <strong>hands-on practical tasks</strong>, students discovered just how exciting and impactful the tech world can be. From basic computer skills to exploring the fundamentals of coding, the workshops aimed to lay a strong foundation for future exploration.</p><blockquote>But this project wasn’t just about teaching skills. It was about nurturing a mindset. The students learned to think critically, ask questions, and envision a future where they could play a key role in shaping the digital world.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zzqfwsn1spCyG_4CMBq2AA.jpeg" /></figure><p><strong>Inspiring Future Innovators</strong></p><p>This project&#39;s most rewarding aspect was witnessing young minds&#39; transformation. These students are more than just participants in a training program; they are Azerbaijan&#39;s future leaders and innovators. For many, this was their first exposure to modern technology and its potential. Yet, their enthusiasm, curiosity, and determination were boundless.</p><p>Through our sessions, we didn’t just share knowledge. We fostered a culture of <strong>learning, research, and ambition</strong>. We empowered these young individuals to dream bigger, take initiative, and explore new directions for their futures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cx3M9H9QqT2sqrrCn4DLXA.jpeg" /></figure><p><strong>A Journey of Growth and Inspiration</strong></p><p>As we reflect on our travels to these villages, we’re filled with gratitude and hope. Each village had its unique charm and stories, but one thing was constant: the incredible resilience and potential of its youth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UJqQhq6ITqyh11-dpzLCw.jpeg" /></figure><p><strong>The Road Ahead</strong></p><p>At <strong>Coders Azerbaijan</strong>, we see this project as just the beginning. Our goal is to bridge the digital divide and ensure that every young person, regardless of where they live, has access to the opportunities brought by modern technologies. With each step, we aim to train the leaders of tomorrow, one village at a time.</p><p>We invite you to join us in this mission. Together, we can inspire, educate, and empower the next generation to reach their fullest potential. Because a career in innovative fields truly is for everyone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YwBWNre3qEUsNh_4j6ak3w.jpeg" /></figure><blockquote><em>Video about </em><strong><em>project</em></strong><em>: </em><a href="https://www.youtube.com/shorts/Z9OyjhW6fRY">https://www.youtube.com/shorts/Z9OyjhW6fRY</a><em><br>Video about</em><strong><em> participants:</em></strong> <a href="https://www.youtube.com/shorts/2sIMQHzfv8A">https://www.youtube.com/shorts/2sIMQHzfv8A</a><br>Video about <strong><em>villages:</em></strong> <a href="https://www.youtube.com/shorts/X5sfa7s841g">https://www.youtube.com/shorts/X5sfa7s841g</a></blockquote><p><strong>What’s Next?</strong></p><p>Follow our journey on Coders Azerbaijan and stay updated as we continue to bring technology to every corner of Azerbaijan. Share your thoughts and support in the comments below — we’d love to hear from you!</p><p>Let’s make innovation accessible to all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b41252363ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cyber Security Issues about Internet of Things and their Solutions]]></title>
            <link>https://codersazerbaijan.medium.com/cyber-security-issues-about-internet-of-things-and-their-solutions-6c199e2f8978?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c199e2f8978</guid>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 11:07:55 GMT</pubDate>
            <atom:updated>2022-07-12T14:59:01.840Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>ABSTRACT</strong></p><p>The Internet of Things (IoT) has grown rapidly in recent years due to its wide range of usability, flexibility, and smartness. The majority of IoT apps carry out tasks automatically, with no input from humans or physical objects. To deploy such a new technology in a secure manner, present and prospective gadgets must be smart, efficient, and capable of providing services to consumers. As a result, researchers are investigating security concerns on a daily basis. Because IoT devices are most portable and light in nature, they have various concerns such as battery consumption, memory, and the most essential is security. In this survey thesis, we explored security threats with relation to several types of IoT layers. Last but not least, we discussed several IoT applications. This research will help academics and manufacturers analyze and reduce the attack range on IoT devices. Keywords: IoT, Smart Homes, HealthCare, Encryption, Security</p><ol><li><strong>Introduction:</strong></li></ol><p>The Internet of Things (IoT) is a new trend in the world today. As technology spreads, it has become a critical need for society, health care, universities, homes, and practically everything to be connected to the internet. According to the research, the number of items projected to be linked worldwide in 2020 is 8.4 billion, with this figure expected to rise to 20.4 billion by 2022. Increase in the use of IoT applications in all settings throughout the world, with connections between machines estimated to expand from 5.6 billion to 27 billion between 2016 and 2024. Some privacy and security, authentication, and storage difficulties have been highlighted as a result of the wide variety of IoT Application usage, and it’s a challenging topic, for the time being, between the research community. It is quite impossible to operate an IoT application with full functionality and in a trustworthy way without a secure environment and infrastructure. According to assaults against IoT devices surged by 600% in 2017. Typically, attackers do not target IoT edges directly, but rather use them as a weapon to gain access to other sites. IoT devices will be readily targeted owing to their manufacturer’s nature, since most firms do not address security and forensics for devices, instead focusing on cost, size, and usefulness. If we peek behind the scenes of our daily lives, we will see a plethora of IoT devices, such as smart electricity meters, which are used to regulate power usage, lights, and other resources. Security cameras are another IoT item that will alert you if there is any unwelcome activity at night. Smart fridges will also alert you if there is a scarcity of drinking milk, and sensor doors that open based on your sound and facial recognition. Guess what, if a firm compromises on security in order to save money and space, it will have an impact on all of the physical items with which you interact on a daily basis in the IoT age. Modern automobiles also use sensors, and if the car sensors and algorithms are hacked, your life is in danger. In today’s healthcare, several sensors are utilized to provide reports to doctors if a patient’s life is in danger due to a targeted attack. Not only in the healthcare sector is IoT security more important; in business, criminals may acquire your bank data and make unauthorized activities. Indeed, these sorts of cyberattacks are the most harmful to huge corporations, as demonstrated by one event from US history, which occurred in 2013; a gang of attackers stole $160 million through credit cards. The key contribution of this research is that we have enlarged on the many security challenges associated to the IoT layered infrastructures and some of the IoT age applications. Simply said, in today’s technology day, anything is vulnerable to cyberattack and might pose a hazard.</p><p><strong>2. IOT SECURITY:</strong></p><p>Because of the billions of IoT smart device communications, IoT security is the most important and difficult challenge for the research community. Because IoT is in its early stages and demand for smart devices is increasing, manufacturers are overlooking security aspects and delivering vulnerable devices to the market. As a result, attackers are easily targeting the devices and performing a large number of DDoS and other types of attacks to steal user personal information and data from IoT devices.</p><p><strong>2.1. Physical Assaults:</strong></p><p>Physical attacks are those in which the attackers rely on the system hardware rather than software.</p><ul><li>Node Tampering: In this sort of assault, the attackers physically or electrically harm the sensor nodes in order to gain access and edit vital information, such as confessing the shared crypto keys, which may damage the entire sensor network.</li><li>Malicious Node Injection: In this sort of attack, the attackers install the malicious node between two or more nodes and monitor the traffic between the nodes. This form of attack is sometimes referred to as a Man in the Middle-Attack.</li><li>Malicious Code Injection: In this sort of attack, attackers attempt to insert malicious code into the node’s memory. As IoT device software updates in the open, attackers will be able to introduce malicious code into the system, allowing the attacker to seize total control of the IoT system.</li><li>Sleep Deprivation: Because most IoT devices rely on batteries for electricity, they must adhere to the sleep cycle in order to last as long as possible. In a sleep deprivation attack, the attacker keeps the devices active, which consumes more battery life and causes the devices to shut down.</li><li>Physical Damage: As the name implies, in this form of assault, the attackers attempt to obtain data by physical acts. Attackers begin by searching through organization garbage bins for information such as date of birth and security numbers for confirming computer passwords.</li><li>Social Engineering: In these attacks, the attackers target people rather than computer systems in order to obtain information. Attackers are attempting to mold the target into a bogus network and engage in harmful operations in order to get data.</li></ul><p><strong>2.2. Software Assaults:</strong></p><p>In these sorts of attacks, the attackers utilize viruses, spyware, and other harmful software to steal data or refuse service.</p><ul><li>Viruses, Warms, and Spywares: Attackers are attempting to transmit certain harmful files as an email attachment so that when the receiver gets the email and downloads the attachment or other files from the internet, the system will be harmed. To identify these sorts of assaults, several technologies such as firewalls, antivirus, and other detection systems offered by researchers can be utilized.</li><li>Malicious scripts: In this sort of attack, the adversary uses malicious scripts in conjunction with the standard query. When standard queries are executed, the scripts execute automatically, posing a risk to the users. According to the Imperva Web Application Attack Report (WAAR) round, about 96.15 percent of Web assaults were carried out.</li><li>Phishing attack: This sort of attack is commonly used to steal the user’s sensitive information such as credit card numbers, email passwords, and so on. Emails or websites are utilized in this form of assault. Adversary creates phishing sites that seem just like the originals and tracks users. The enemy can make advantage of emails, websites, and phone calls.</li><li>DoS Attack: A denial of service attack occurs when an adversary sends unexpected traffic to a system, rendering the resources inaccessible to other users. The attacker can potentially deceive the data and modify it for resending in a denial-of-service attack.</li></ul><p><strong>2.3. Network Assaults:</strong></p><p>Because IoT devices move about and are connected to the internet, they are more vulnerable to attacks. Some network attacks are addressed further below.</p><ul><li>Traffic Analysis: The adversary attempts to get the packet pattern and modify the contents in this sort of attack. Although certain packets are encrypted, we cannot assume that they are secure against assaults.</li><li>RFID Cloning: This sort of assault uses tags to depict specific tags, which might lead to unmanageable dangers.</li><li>RFID Unauthorized Access: Because RFID tags are responsible for sending and receiving data using distinct signals, there is a greater potential that someone will put the RFID card reader and steal the data.</li><li>RFID spoofing: RFID tags are not physically reproduced in this sort of assault. In a spoofing assault, the adversary uses customized equipment with additional functionalities capable of mirroring RFID tags in order to get data. The enemy is attempting to gain access to the original RFID tag and will do so by any means necessary. Using this strategy, the adversary gains complete access to data channels as the original tag.</li><li>Sinkhole Assault: In this attack, the adversary attempts to install a malicious node between the actual nodes in order to broadcast the bogus routes through the RPL routing protocol in IoT. As a result, the attacker node is responsible for the majority of the hops. This sort of assault will also have an impact on the performance of IoT devices.</li><li>MITM Attack: The adversary sits between the nodes and interprets the communication between the two parties in this form of attack. When the sender sends information, the adversary receives it and modifies it before transferring it to the recipient rather than the real value. When the recipient responds, the opponent follows suit and responds to the sender. Most of the time, this sort of attack is used to obtain credit card login information or other personal information.</li><li>Routing Information Attack: In this sort of attack, the adversary attempts to redirect traffic straight through a bogus route in order to obtain access to sensitive data.</li></ul><p><strong>2.4. Encryption Attacks:</strong></p><p>In this form of attack, the adversary attempts to get access to the plain text by various means such as stealing the key, discovering flaws in the code, cryptographic protocol problems, and so on.</p><ul><li>Side channels attack: In this sort of attack, the adversary targets physical security implementations in order to leak personal and sensitive data. This type of assault has grown in popularity in recent years.</li><li>Cryptanalysis attack: In this form of assault, attackers attempt to discover flaws in crypto algorithms and infer crypto keys.</li><li>MITM Attack: A man in the middle attack in which the attacker attempts to steal public value. Instead of using the original public value, the attackers create their own keys and transmit them to the recipient in reply states.</li></ul><p><strong>3. APPLICATION AREAS OF IoT:</strong></p><p>Security and privacy are critical criteria for any IoT devices and apps that are already in use or will be in the near future. With the fast advancement of technology, the use of IoT applications is growing by the day. All manufacturers are working to improve device security, but some applications are extremely sensitive, particularly in the health care system, and hence necessitate stringent security standards. The following are some examples of IoT applications.</p><ul><li>Smart Houses: Smart homes are now the most useful and efficient IoT application. According to the study, consumers looked for smart house 60,000 times. Another important note is that approximately 256 firms are engaged in smart home products and startups and are currently bulleting the features for IoT Uses, which aids IoT in quick expansion.</li><li>Smart Cities: Another IoT application that is gaining popularity throughout the world is smart cities.</li><li>One of the most common and sensible applications of IoT in the health system. As we look into the system, wireless sensors are being placed in the patient’s body and connected to the cloud in order to relay patient information to the doctor. If we look at the opposite side, if the doctor got genuine information and referred the medicine, and it was hacked in some manner, and the enemy modified the medicine report, it is also a big danger for the patient.</li><li>Security and Emergencies: Another use in the IoT system is security and emergencies. Today, most army operations, particularly in the demining field, employ most of the machinery for such a work, and they also install wireless sensors to prevent illegal entry to banned areas. Wireless sensors are deployed in most buildings to monitor burglar activity, manage lighting and water systems, and much more.</li></ul><p><strong>4. IOT SECURITY:</strong></p><p>As we discussed some of the security challenges in the previous part, we will now discuss some of the methods for safeguarding IoT applications and the environment in this area. Edge computing, fog computing, blockchain, and machine learning are the four key strategies for defending the IoT ecosystem. The following are some in-depth explanations of the approaches mentioned.</p><ul><li>Fog Computing for IoT Security: The majority of users and gadgets in the internet of things are portable, and data is kept in cloud computing. As a result, there are additional issues to solve, such as security, power consumption, bandwidth, and dependability. The authors of developed three levels of architecture to operate between the transmitter and recipient to tackle storage, processing overhead, limited resources, and security and privacy challenges in (G.Zhuo, Q.Jia, L.Guo, M.Li, &amp; Pan Li, 2016). (Zhang, J., Li, Q., Wang, X., 2018) adds the COLOR + technique, which is used to execute the majority of the calculation on the terminal node. COLOR + is also used to detect spammers based on suspension.</li><li>Machine Learning for IoT Security: As previously stated, Dos attacks are one of the most common techniques of stealing data in the IoT environment. The Multi-Layer Perceptron (MLP) is utilized to protect against such significant attacks. The authors of (R.V. Kulkarni, G.K.Venayagamoorthy, 2009) introduced particle swarm optimization using the back propagation technique to improve wireless network security. Eavesdropping is another sort of attack that has emerged in IoT. During the communication, the adversary may 50 drop packets. To protect against this form of assault, machine learning approaches like Q-learning-based offloading strategies or non-parametric Bayesian techniques might be applied.</li><li>Edge Computing for IoT Security: As with edge computing, data transfer occurs within the network or within the device. When compared to fog computing, data movement is reduced, which reduces security concerns. Another concern is data compliance in some nations, which refuse to exchange data with other countries and impose limits on it. As a result of adopting edge computing, the data compliance problem will be solved. Another issue that is addressed by edge computing is the question of safety. If the user does not have a fast internet connection, everything will be transferred to the cloud and will wait for a response, which may jeopardize a person’s or group’s safety.</li><li>Block chain approaches for IoT security: Blockchain technology is the most significant advancement in IoT security. Which focuses solely on the secure application of IoT? In a nutshell, Blockchain is a transactional database that stores all transactions as hashes. In (O. Novo, 2018), the author offers a novel access control system that moderates the different concerns associated with IoT devices. The paper’s approach is decentralized and built on Blockchain technology. As a single point system is one of the major difficulties in the IoT ecosystem, the (P.LV, L. WANG, H.ZHU, W. DENG, and L.Gu, 2019) author has presented a novel decentralized method for IoT called privacy-preserving publish/subscribe utilizing Blockchain technology.</li></ul><p><strong>CONCLUSION</strong></p><ul><li>In this article, we emphasized on the security dangers to IoT devices pertaining to several IoT layers, such as physical, software, network, and encryption levels. We’ve also spoken about several IoT applications. We anticipate that this survey will be useful for IoT researchers and manufacturers in improving the security level of future IoT gadgets.</li></ul><p><strong><em>| Ertughrul Gayibov</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c199e2f8978" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Funksiya nədir?]]></title>
            <link>https://codersazerbaijan.medium.com/funksiya-n%C9%99dir-c2af7df69fcb?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2af7df69fcb</guid>
            <category><![CDATA[proqramlaşdırma-öyrənmək]]></category>
            <category><![CDATA[proqramlaşdırma]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 15:45:41 GMT</pubDate>
            <atom:updated>2021-08-16T15:45:41.356Z</atom:updated>
            <content:encoded><![CDATA[<p>Funksiya, riyaziyyatda rəqəmləri <strong>input </strong>olaraq qəbul edib, bu rəqəmlərdən bir <strong>output </strong>yaradan qanunlardır. Proqramlama dillərində isə, bir funksiya daxil edilən parametrlərə uyğun olaraq, həmin funksiyanın kod bloku içində olan əməlləri edərək geri bir cavab qaytarır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*oQAb9AVHi2_DQHHn9lzVbA.png" /></figure><p>Burada, <strong>def(definition)</strong> “yarat”, deyərək bir funksiya yazacağımızı deyirik.</p><p>Daha sonra funksiyaya bir ad veririk.Funksiyaya veriləcək adın, kodun işləməsi baxımından heç bir fərqi yoxdur. Lakin funksiyaya məntiqi adlar vermək daha məqsədə uyğun olar.</p><p>Funksiyanın işləməsi üçün onu çağırmalıyıq(funksiyalar çağrılmadan işləmir):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*1vbnuR3RwThoqnuWdvoj9Q.png" /></figure><p><strong>Parametr anlayışı:</strong></p><p>a və b isə parametrlər adlanır. Biz bu funksiyanı çağırarkən bu parametrlərə istədiyimiz dəyərləri göndərə bilərik. Aşağıdakı nümunəyə baxaq:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*ONA1gf-XoKkzJedwf0Fx9Q.png" /></figure><p>Funksiya yaradırıq, ad veririk, mötərizə içərisində parametr veririk (istədiyimiz adda və sayda parametr verə bilərik). Funksiya isə <strong>a + b cəmini</strong> print funksiyası köməyi ilə ekrana yazır.</p><p><strong>Geriyə dəyər qaytaran (return):</strong></p><p>Əgər bir funksiyanın nəticəsini sadəcə print edəcəyiksə, bu halda return yerinə birbaşa print edə bilərik, ancaq niyyətimiz bu funksiyadan bir dəyər döndərmək və bu dəyəri başqa yerdə istifadə etməkdirsə, bu halda <strong>return’</strong>dən istifadə edirik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*_C1ETwKfD1Xnj7jOR-GZ6A.png" /></figure><p>Bu iki funksiyada alqoritmik ardıcıllıq baxımından heç bir fərq yoxdur. Sadəcə <strong>return </strong>daha sonra istifadə etməyimiz üçün dəyər döndərərkən print dəyəri birbaşa ekrana yazır.</p><p><strong>Bəs funksiyalar həyatımızda olmasaydı?</strong></p><p>Funksiyasız, bu tərzdə eyni cavabı ala bilərik. Ancaq bir-iki sətir deyil, onlarca, yüzlərcə sətrlik bir kodu funksiyasız yazdığınızı düşünün. Bu halda, əgər ikinci dəfə başqa parametrlər ile eyni nəticəni almaq istəsəniz, gərək yazdığınız qədər kodu yenidən yazasınız. Kod, funksiya formasında olanda isə sadəcə parametrləri göndərərək funksiyanı işə sala və eyni nəticəni ala bilərsiz.</p><p>Gördüyünüz kimi,funksiyalar,bir kod blokundan bir neçə dəfə istifadə edəcəyiksə,yardımımıza çatır. Əks təqdirdə:</p><p>• Eyni kodu kopyalayıb yapışdırmağımıza</p><p>• Yazdığımız proyektin optimallığının azalmasına</p><p>• Kodun səliqəsiz və struktursuz görsənməsinə</p><p>Və.s problemlərə gətirib çıxarır.</p><p><strong>İlkin dəyər (Default value):</strong></p><p>Default value, bir funksiyadakı parametrlərə öncədən dəyər təyin etmək anlamına gəlir. Örnək olaraq təyin etdiyimiz funksiya 3 dəyər(arqument) alsın( <strong>a , b , c</strong> ). Əgər bu funksiyanın tələb etdiyindən az dəyər göndərsək, məsələn 3 yox 2 parametr göndərsək, kod bloku xəta verər.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*j9HZLtOEFxNNV-7sYwWnGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*y4ByMvAbpoE4BmWHelEidw.png" /></figure><p>Əgər dilimizə tərcümə etsək. topla() funksiyasının bir tələb olunan arqumenti yoxdur ‘c’</p><p>Burada kod editörü, bizim c dəyərini göndərmədiyimizi deyir. Biz bəzən 1,bəzən 2,bəzən 3 dəyər ilə funksiyanı çağırmaq istəyiriksə və eyni zamanda funksiyanın xəta verməməsini istəyiriksə, bu kimi vaxtlarda arqumentlərə ilkin dəyər təyin edə bilərik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*1bxN9E6QhLPO0Jb_b5Jkbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*GCTHWoAE4nE1NkLQ4KzC5w.png" /></figure><p>Son ilkin dəyər barəsində onu bildirmək istərdim ki , bir arqumentə ilkin dəyər verilibsə o arqument sonda yazılmalıdır. Bu şərtdə məsələn c yox b üçün ilkin arqument təyin etmək istəsəydik gərək <strong>a, c, b = 2</strong> kimi yazaq.</p><p>Eyni zamanda birdən çox arqumentə ilkin dəyər verə bilərik sadəcə tək qayda odur ki, ilkin dəyəri olan arqument, ilkin dəyəri olmayan arqumentdən əvvəl yazıla bilməz.</p><p><strong>Bunun səbəbi nədir?</strong></p><p><strong>a = 2, b , c</strong> tərzində yazdıq deyək. <strong>a</strong> nın dəyərin göndərmədik ‘onsuzda ilkin dəyəri var, xəta verməyəcək’ deyə düşündük. Lakin biz <strong>(3,5)</strong> deyə funksiyanı cağırarkən:</p><p>Növbə ilə <strong><em>a ya 3 b yə isə 5</em></strong> dəyərini verir. Beləcə c nin yeri boş qalır və funksiya xəta verir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*dxch7nZYiupF7aLdfriTmA.png" /></figure><p><strong><em>Ilkin dəyəri olan arqumenti , ilkin dəyəri olmayan arqument izləyir.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*Lf0Tei9DCYHpoj60mFYX6w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2af7df69fcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PYTHON Verilənlərin tipləri]]></title>
            <link>https://codersazerbaijan.medium.com/python-veril%C9%99nl%C9%99rin-tipl%C9%99ri-5a5a1aa53b31?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a5a1aa53b31</guid>
            <category><![CDATA[proqramlaşdırma-öyrənmək]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[proqramlaşdırma]]></category>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Tue, 13 Jul 2021 09:02:49 GMT</pubDate>
            <atom:updated>2021-07-13T10:22:17.404Z</atom:updated>
            <content:encoded><![CDATA[<p>Birçox proqramlaşdırma dilində olduğu kimi <strong>Python </strong>da data tiplərini istifadə etməyə icazə verir. Hətta Python-da bu barədə daha çox çeşid mövcuddur. Təbii ki, məlumatlar bir çox fərqli tipdə ola bilirlər. Biz isə bu gün yazı (string), boolean və ədəd (integer , float, complex) və casting tipləri barədə danışacağıq.</p><p><strong>String</strong></p><p>Dırnaq işarəsinin içərisinə yazılmış hər şey <strong>stringdir</strong> və qısaca <strong>str </strong>kimi yazılır. Burada tək dırnaqdan (<strong>‘</strong>str<strong>’</strong>) istifadə edilə bilir. İndi bir dəyişən yaradaq və ona bir stringi mənimsədək.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*yTfS-U4vstPSyOKidmrM8A.jpeg" /></figure><p>Lakin bəzi hallarda bu işə yaramır və yazım xətası baş verir. Məsələn :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*3qdTiZVuzmCy-5oVVbO-Bg.jpeg" /></figure><p>əgər stringin daxilində tək dırnaq işlənəcəksə bu zaman stringi qoşa dırnaq (<strong>“</strong>str<strong>”</strong>)<strong> </strong>içərisində qeyd edirik. Bu zaman yazım xətası baş vermir. Həmçinin stringin içərisində qoşa dırnaq istifadə edilərsə bu zaman string tək dırnaq içərisində qeyd edilməlidir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*YLSHGlZXyMZ2NYnbh-bT9w.jpeg" /></figure><p>Ola bilər ki, string ifadəmiz çox uzun olar və biz tək sətir ilə qane olmarıq. Bu zaman string ifadənin əvvəlinə və sonuna 3 ədəd dırnaq işarəsi tək və ya qoşa dırnaq (<strong>‘’’</strong>str<strong>’’’, “””</strong>str<strong>”””</strong>)<strong> </strong>istifadə edilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*PADAG65jozYXtaN36EFcfA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*WcfzZ0Uu2GU6gKuhPdPjxg.jpeg" /></figure><p>İlk numunədə program bizə yazım xətası olduğunu bildirir, lakin ikinci nümunədə isə bu yoxdur. Hər hansısa bir məlumatın tipini öyrənmək üçün <strong>type () </strong>metodundan isitifadə edilir. İndi <strong>type() </strong>metodu vasitəsi ilə stringin tipini yazdıraq.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*RFYgPPU4QoV6ju6c8kdFlw.jpeg" /></figure><p>Stringlərdə toplama <strong>+</strong> və vurma <strong>*</strong> işarələrindən də istifadə edilə bilir, lakin bu zaman həmin işarələr riyazi formada deyil stringə xas xüsusiyyətlərini yerinə yetirirlər. Toplama işarəsi birləşdirmə, vurma işarəsi isə bir stringi istədiyimiz sayda yazdırmağa kömək edə bilir :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*H7FzjZKmg6l8A3qasK5h_Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*s6QZqrCVgQ-moqWi3opsug.jpeg" /></figure><p><strong>Boolean</strong></p><p>Adını riyazi məntiqin qurucusu sayılan <em>George Boolenin </em>adından alan ve Boole cəbrinin iki doğruluq dəyərini ifadə edən dəyərlərdən (<strong>True</strong> (doğru) və ya <strong>False </strong>(səhv) ) birinə sahib olan bir ifadəyə <strong>Boolean</strong> deyilir. Bütün programlama dillərində boolean çox böyük əhəmiyyət daşıyır. Xüsusuilə, program gedişatının yönləndirilməsində və dövr içərisində bizim çox köməyimizə gəlir. Həmçinin digər dillərdə də olduğu kimi bu ifadədə <strong>0 </strong>həmişə Flase (səhv) cavabı <strong>1 </strong>isə True (doğru) cavabını bizə geri qaytarır. Məsələn baxaq :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*JaQ9c-MJ0gGctj1uwNubIA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*wLUavLMCJ24G_owxvm8fyw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*EXQ5K-fJITxgSRpftmBGyA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*wUdl1kxt7Bgj3QddsmnbRA.jpeg" /></figure><p>İndi bir paytaxt dəyişəni yaradıb ona Bakı stringini mənimsədək və a hərfinin Bakı stringinin içində olub olmamasını yoxlayaq.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*dH5Jh-NfwxK7kly1OEK1FA.jpeg" /></figure><p><strong>Ədəd tipləri</strong></p><p><strong>İnteger — Tam ədədlər</strong></p><p>Ədəd tipləri bütün dillərdə olduğu kimi Python-da da vardır və çox istifadə edilir. Bunlardan ilki <strong>İnteger</strong> — Tam ədədlər, qısa yazılışı ilə int. Tam ədələr -99, -15, 0, 5, 130 yəni sadəcə tam hissəli ədələrdir. Bu ədədlər riyazi hesablamlarda daha çox istifadə edilir. Bir dəyişkən yaradaq və onun tipinə baxaq:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*dl__aVU9ZDt1PLQ34t1bSw.jpeg" /></figure><p>İntegerlərdə <strong>+</strong> işarəsi toplamaq, — işarəsi çıxmaq , <strong>*</strong> işarəsi vurmaq , <strong>**</strong> işarəsi qüvvətə yüksəltmək, <strong>//</strong> işarəsi bölmə zamanı yaranan tam hissəni götürmək, <strong>%</strong> işarəsi isə bölmə zamanı yaranan qalığı götürmək üçün istifadə edilir.</p><p><strong>Toplama :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*ozxnCPElnUtLnOYlD-1OQA.jpeg" /></figure><p><strong>Çıxma :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*QsKB2rgdHOJQRjatsFOwdQ.jpeg" /></figure><p><strong>Vurma :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*Mam_NEeM3YBrD9Nbe9KpVQ.jpeg" /></figure><p><strong>Qüvvətə yüksəltmə:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*3msMoR1mI7K_0Jx9yAKI0A.jpeg" /></figure><p><strong>Tam hissəni alma :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*A2auwgJ4kg4sag9bjzD_LQ.jpeg" /></figure><p><strong>Qalığı alma:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*rs3R31mRs4qoaSPy9_vCEw.jpeg" /></figure><p><strong>Float — Kəsr ədədlər</strong></p><p>Bölmə əməliyyatından istifadə etdikdə görəcəyik ki, nəticə hər zaman <strong>Float</strong> ifadə qaytarır. Bəs float nədir? float kəsr ədədlərdir. 10.2 və ya -3.5 buna misal ola bilər. Digər riyazi əməllər integerdə olduğu kimi floatda da eynilə istifadə edilir. Bölmə əməli zamanı qismət tam olsa belə rəqəmin sonuna <strong>.0 </strong>əlavə olnduğu üçün cavab bizə float ədəd olaraq geri qayıdır.</p><p><strong>Bölmə :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*5a164Ojdev_gbEgQSP75Cg.jpeg" /></figure><p><strong>Complex — Qarışıq ədələr</strong></p><p>Complex ədələr qarışıq ədələrdir. Bunlar real ədəd və virtual ədələrin birlikdə istifadəsi zamanı yaranır. Məsələn baxaq :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*shRSf2aH89Z0L3NOQMEyqg.jpeg" /></figure><p><strong>Casting</strong></p><p>Casting bizə verilənlərin tipini dəyişmək üçün lazım gəlir. Məlumatlar hər zaman statik olmur və bizə istifadəçidən də gələ bilir. Bu zaman istifadəçinin göndərdiyi məlumatı lazım olduğu formada qəbul etməli və ya sonradan tipini dəyişməli ola bilirik. Bunun üçün <strong>int()</strong>,<strong> float() </strong>ve <strong>str() </strong>funksiyalarından istifadə edəcəyik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*mvcUNhOMZ5OwDK1E7bZidw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*8fYW2lmUPlUz92ePZbwpvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*AS1-9gQbmHqMq-_gC636sg.jpeg" /></figure><p>Bir kəsr ədədi (float) tam ədədə (integer) çevirdikdə kəsr hissə atılır, tam hissə saxlanılır. Məsələn aşağıdakı nümunəyə nəzər yetirək :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*535FhTRdM63P0D2tU1HVJg.jpeg" /></figure><blockquote><strong>Pünhan Səlimli</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a5a1aa53b31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[String Metodları]]></title>
            <link>https://codersazerbaijan.medium.com/string-metodlar%C4%B1-70bc00d294e8?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/70bc00d294e8</guid>
            <category><![CDATA[proqramlaşdırma]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[proqramlaşdırma-öyrənmək]]></category>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Sat, 19 Jun 2021 17:11:26 GMT</pubDate>
            <atom:updated>2021-07-13T10:28:55.146Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>len — </strong>bir mətnin uzunluğunu və ya simvol sayını öyrənmək üçün istifadə olunur.Məsələn, istifadəçidən online form doldurmağını istədikdə,amma formda simvol limiti olduqda bu metoddan istifadə edə bilərik.Məsələn,ad hissəsinin maksimum 15 simvoldan ibarət olduğunu təyin etmişik və istifadəçi oraya 20 simvollu ad daxil etdikdə ona xəta mesajı verməkdə köməyimizə çata bilər:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*tQ-QmY4c8Bc8LqkP3uF3Fw.png" /></figure><p><strong>upper()</strong> — Bir mətnin simvollarının hamısını böyük hərfə çevirir.Biz bu funksiyalara nöqtə ( . ) ilə çatırıq.Simvolları böyük hərflərə çevirən metod:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*LM5lxC_Ln2hAwGiGDwKwLg.png" /></figure><p><strong>lower() — </strong>Simvolları kiçik hərflərə çevirən metod:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*NkxGuLAz-9Dufjs7T9ci9w.png" /></figure><p><strong>title() — </strong>Mətnin içindəki sözləri tapır və sözlərin ilk hərflərini böyük,geri qalan hərfləri isə kiçik hərfə çevirir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*VM7xQU1Rz_T3Om7-N44GKg.png" /></figure><p><strong>capitalize() — </strong>Mətndəki ilk hərfi böyük hərfə çevirir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*JkpDIhiiym_Xf7TkLINAhQ.png" /></figure><p><strong>count() — </strong>İfadədə axtarılan sözün və ya simvolun sayını tapır.Əgər söz və ya simvol varsa onun sayını, yoxdursa 0 qaytarır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*Zsk3WmDIuQ66gDShbLep0A.png" /></figure><p><strong>startswith() — </strong>İfadə göstərilən simvol və ya sözlə başlayarsa True qaytarır, əks halda False.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*MvLdriHyYHk7uGZbTPcnJQ.png" /></figure><p><strong>endswith() — </strong>İfadə göstərilən dəyərlə bitərsə True qaytarır, əks halda False</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*yJBZ0AZxXY1YKNSK7ck9ag.png" /></figure><p><strong>find() — </strong>İfadədə göstərilən dəyəri tapır və onun ilk başladığı yerdəki indeksini göstərir.Əgər ifadədə olmayan dəyər versək bizə -1 qaytarır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*JNwObkaJYnGNYxce6S6UTQ.png" /></figure><p><strong>index() — </strong>İfadəni müəyyən bir dəyər üçün axtarır və tapdığı yerin indeksini qaytarır.Əks halda xəta verir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*zvGWjwjFRhoz9B-pZifSQg.png" /></figure><p><strong>join() — </strong>join () metodu təkrarlana bilən obyektlərdən string yaratmaq üçün rahat bir yol təqdim edir.Hər bir təkrarlana bilən elementi ( list, string, dictionary ) ayırıcılarla birləşdirir ( join () metodunun çağırıldığı sətir ) və birləşdirilmiş sətri qaytarır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*BOzXws3XONFDVju6JYeq5g.png" /></figure><p><strong>format() — </strong>Bir İfadədə göstərilən dəyərləri formatlaşdırır.Format-dan 3 formada istifadə etmək olar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*lJBY_TgVkURBd2So82BQ8Q.png" /></figure><p><strong>isdigit() — </strong>Sətirdəki bütün simvollar rəqəmdirsə True qaytarır. Unicode olduqda verilən ifadədə əgər string olarsa isdigit() metodu yenə də True qaytaracaq. Bunun səbəbi odur ki, isdigit() sonda alınan cavaba baxır, əgər unicode-dan çıxan cavab rəqəmdirsə True qaytaracaq.</p><p><strong>isdecimal() — </strong>İsdecimal metodu isə unicode olduqda onun içərisində string ifadə gördükdə nəticəyə baxmadan False qaytarır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*3oooudyfgg2TvIoPRuoshQ.png" /></figure><p><strong>split() — </strong>İfadədəki hər sözü bir list obyekti olaraq bölür. Biz split metoduna istədiyimiz dəyəri verərək, ifadəni dəyərə əsasən bölə bilərik.Biz həmçinin verdiyimiz dəyərdən ifadədə çox olarsa onun sayını da verə bilərik və split metodu bizim verdiyimiz saya əsasən ifadəni böləcək.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*TAnHwTfLCrUL0DevJn1RNg.png" /></figure><p><strong>strip() — </strong>İfadənin əvvəlindəki və axrındakı qeyd etdiyimiz dəyəri aradan qaldırır, boşluq olduqda isə boşluğu aradan qaldırır.</p><p><strong>lstrip() — </strong>İfadənin sol tərəfində yerləşən verdiyimiz dəyəri silir.</p><p><strong>rstrip — </strong>İfadənin sağ tərəfində yerləşən verdiyimiz dəyəri silir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*B2SERLyOO6t_gy0ChmWpeQ.png" /></figure><p><strong>replace() — </strong>Müəyyən edilmiş bir dəyərin müəyyən bir dəyərlə əvəz olunduğu bir ifadə qaytarır.Biz dəyişəcəyimiz simvolların sayını da göstərər bilərik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*mEZN9vNLPMRK4PsxdDkFaw.png" /></figure><blockquote><strong>Səməd Səmədli</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70bc00d294e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comprehensions]]></title>
            <link>https://codersazerbaijan.medium.com/comprehensions-3b91ddbab93e?source=rss-a1d75e082e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b91ddbab93e</guid>
            <category><![CDATA[proqramlaşdırma-öyrənmək]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[proqramlaşdırma]]></category>
            <dc:creator><![CDATA[Coders Azerbaijan]]></dc:creator>
            <pubDate>Sun, 02 May 2021 10:29:20 GMT</pubDate>
            <atom:updated>2021-07-13T10:29:27.357Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>‘Comprehension’ nədir?</strong><br> Pythonda ‘comprehension’ bizə mövcud ardıcıllıqlardan istifadə edərək, yeni ardıcıllıqlar (list, set,dict və s.) yaratmağa imkan verir.Yəni, dövrlərdən və şərtlərdən istifadə edərək yazdığımız uzun kod blokları əvəzinə daha səliqəli və bir sətirlik kod blokları yazmaq ikmanı yaradır.Pythonda əsasən 3 növ ‘comprehension’ istifadə olunur.</p><p>1. List (matrikslər üçün)</p><p>2. Set (çoxluqlar üçün)</p><p>3. Dictionary (lüğətlər üçün)</p><p><strong>List comprehension</strong></p><p>‘Comprehension’ istifadə edərək birbaşa list yaratmaq və ya mövcud listdən müəyyən şərt daxilində elementlər götürərək yeni list yaratmaq olar.Gəlin,nümunəyə baxaq:</p><p>Tutaq ki, biz, içində 1-dən 20-yə qədər ədədlər olan my_list adında bir list yaratmaq istəyirik,Bunun üçün hər bir ədədi ya özümüz yazmalıyıq,ya da çox sətirli kod bloklarından istifadə etməliyik.</p><pre><strong>my_list = [ ]<br><em>for </em>i <em>in </em>range(1,20):<br>     my_list.append(i)<br>print(my_list)</strong></pre><p>Onun əvəzinə isə ‘comprehension’ istifadə edərək daha yığcam kod yazmaq olar.Burada birinci yazılan (i) dəyişəni listə əlavə olunacaq elementi təmsil edir və for dövrü ilə bağlıdır.</p><pre><strong>my_list=[i <em>for </em>i <em>in </em>range(1,20)]<br>print(my_list) #nəticə:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]</strong></pre><p>İndi isə,mövcud listin müəyyən şərt daxilində götürülmüş elementlərindən necə yeni list yaratmaq olar ona baxaq. Tutaq ki,bir listin içindəki cüt ədədləri götürüb, yeni bir listə əlavə etmək istəyirik.Əvvəlcə bunu adi qayda ilə edək.</p><pre><strong>my_list = [1,2,3,4,5,6]<br>new_list = [ ]<br><em>for </em>i <em>in </em>my_list:<br>     <em>if </em>i%2 == 0:<br>         new_list.append(i)<br>print(new_list) #nəticə [2, 4, 6</strong>]</pre><p>Gəlin, indi ‘comprehension’ ilə yazılışına baxaq:</p><pre><strong>my_list=[1,2,3,4,5,6]<br>new_list=[i <em>for </em>i <em>in </em>my_list <em>if  </em>i%2 == 0]<br>print(new_list) #nəticə [2, 4, 6]</strong></pre><p>Göründüyüz kimi burda sintaksis 3 hissədən ibarətdir:</p><p>1.Listə əlavə olunacaq elementi təmsil edən dəyişən(şərt ödəndiyi halda) — i</p><p>2.Dövr —<strong> <em>for </em>i <em>in </em>my_list</strong></p><p>3.Şərt — <strong><em>if </em>i%2 == 0</strong></p><p>İndi isə, listdəki tək elementəri 2 dəfə, cüt elementləri 3 dəfə artıran bir proqram yazaq və bunu ‘comprehension’ ilə edək.</p><pre><strong>my_list=[1,2,3,4,5,6]<br>new_list=[i*2 <em>if </em>i % 2 == 1 <em>else </em>i*3 <em>for </em>i <em>in </em>my_list ]<br>print(new_list) #nəticə [2, 6, 6, 12, 10, 18]</strong></pre><p>Gördüyünüz kimi, adi yazılışdan fərqli olaraq burada birinci şərt bloku, daha sonra dövr yazılır.Əgər if blokundakı şərt ödənilirsə, birinci proses(i*2) əks halda isə ikinci proses (i*3) həyata keçirilir və listə əlavə olunur.</p><p>‘Comprehension’ da həmçinin, iç-içə dövrlərdən istifadə edərək ikili listlər yarada və ya mövcud listlərin üzərində iterasiya edə bilərik.Gəlin, əvvəlcə sadə bir ikili list yaradaq və bunu adi qayda ilə edək.</p><pre><strong>new_list = [ ]<br><em>for </em>i <em>in </em>range(3):<br>     temp = [ ]<br>     <em>for </em>j <em>in </em>range(3):<br>         temp.append(i)<br>     new_list.append(temp)<br> <br>print(new_list) #nəticə [[0, 0, 0], [1, 1, 1], [2, 2, 2]]</strong></pre><p>Gördüyünüz kimi kod uzun oldu və əlavə dəyişənlər istifadə etməyə məcbur olduq.Bu isə, heç də xoşa gələn hal deyil.Gəlin kodu daha yığcam hala salaq.</p><pre><strong>new_list=[ [ i <em>for </em>j <em>in </em>range(3) ] <em>for </em>i <em>in </em>range(3) ]</strong></pre><pre><strong>print(new_list) #nəticə [[0, 0, 0], [1, 1, 1], [2, 2, 2]]</strong></pre><p>Burada sintaksis 2 əsas hissədən ibarətdir və hər iki hissəyə ayrı-ayrılıqda ‘comprehension’ tətbiq olunmuşdur.Həmçinin, 1-ci hissənin özüdə 2 hissədən ibarətdir.</p><p>1. [ i <em>for </em>j <em>in </em>range(3) ]</p><p>1. i</p><p>2. for j in range(3)</p><p>2. <em>for </em>i <em>in </em>range(3)</p><p>Əvvəlcə i dövrü işləyir.</p><p>1-ci addımda i=0, j dövrü 3 dəfə işləyərək [ 0, 0, 0 ] listini yaradır və bu listi əsas listə əlavə edir.</p><p>2-ci addımda i=1, j dövrü 3 dəfə işləyərək [ 1, 1, 1 ] listini yaradır və bu listi əsas listə əlavə edir.</p><p>3-cü addımda i=2, j dövrü 3 dəfə işləyərək [ 2, 2, 2 ] listini yaradır və bu listi əsas listə əlavə edir.</p><p>Koddan da göründüyü kimi,j dövrü bir növ yuxarıdakı nümunədəki temp dəyişənin rolunu oynayır.</p><p>Bu yazımızda ümumi ‘compherension’ anlayışı ilə tanış olduq və ‘list compherension’ aydınlaşdırdıq.Növbəti yazımızda ‘set,dict compherension’ haqqında danışacağıq.</p><blockquote><strong>Vəli Vəliyev</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b91ddbab93e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>