<?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 Sevda Sanver on Medium]]></title>
        <description><![CDATA[Stories by Sevda Sanver on Medium]]></description>
        <link>https://medium.com/@sevdasanver?source=rss-fdce6a1b214f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OtM38IGgNIbR8mGtODUONA.jpeg</url>
            <title>Stories by Sevda Sanver on Medium</title>
            <link>https://medium.com/@sevdasanver?source=rss-fdce6a1b214f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:34:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sevdasanver/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[The Three Types of Machine Learning:]]></title>
            <link>https://medium.com/@sevdasanver/the-three-types-of-machine-learning-7cc601e0bdbe?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cc601e0bdbe</guid>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Tue, 04 Apr 2023 06:25:17 GMT</pubDate>
            <atom:updated>2023-04-04T06:25:17.346Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qf6doi4KAylKrW9k.jpeg" /></figure><p>Machine learning is a rapidly evolving field of artificial intelligence that has the potential to revolutionize the way we interact with technology. It involves creating algorithms and statistical models that enable computers to learn from data and improve over time.</p><p>There are three main types of machine learning: <strong>supervised learning, unsupervised learning, and reinforcement learning</strong>, each with unique characteristics and use cases.</p><p><strong>Supervised learning:</strong></p><p>Supervised learning is a type of ML that involves <strong>training a model on labeled data.</strong> In other words, the input data is already <em>categorized</em> or <em>labeled</em> with known outputs, and t<strong>he model learns to predict the output for new, unseen data based on the patterns it recognizes in the labeled data.</strong> This type of ML is commonly used for classification and regression tasks, such as predicting customer churn or fraud detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r0dNmFy7wFlMGyr4.gif" /></figure><p>So, basically supervised ML <strong>a</strong>lgorithms learn to make predictions or decisions based on <strong>labeled examples</strong> in a dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TNXchunJxC-L39aP.jpeg" /></figure><p><strong>Unsupervised learning:</strong></p><p>Unsupervised learning involves training a model on unlabeled data, meaning that<strong> there are no predefined categories or labels for the input data.</strong> The model learns to <strong>recognize patterns and relationships</strong> in the data <strong>without any external guidance.</strong> This type of ML is commonly used for clustering and anomaly detection, such as identifying groups of similar customers or detecting unusual behavior in financial transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*sp5bdVF2-BADcKC0.jpg" /></figure><p><strong>Reinforcement learning:</strong></p><p>Reinforcement learning involves <strong>training a model through trial and error</strong>, where <strong>the model learns to make decisions based on rewards and punishments.</strong> The model is given a goal or objective, and<strong> it learns to take actions</strong> that <strong>maximize the reward and avoid punishments.</strong> This type of ML is commonly used in robotics, game AI, and autonomous vehicles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*t_nHuieajq7K1HaG.jpg" /></figure><p>Choosing the right type of machine learning for a given problem depends on the specific use case and the available data. In many cases, a combination of different ML techniques may be necessary to achieve the desired outcome. Regardless of the type of ML used, the ultimate goal is to create accurate and reliable models that can <em>make predictions </em>and <em>provide valuable insights</em> for businesses and organizations.</p><p>In conclusion, understanding the differences between the three types of machine learning is crucial for anyone looking to utilize this technology in their business or project. With the ability to analyze large amounts of data and make predictions based on that data, machine learning has the potential to transform many industries, from healthcare to finance to retail.</p><p>As we continue on our machine learning journey, we will dive deeper into each type and explore their nuances and applications. By doing so, we can gain a more comprehensive understanding of how machine learning works and how it can be leveraged to create innovative solutions and improve our lives in countless ways.</p><p>So stay tuned for our next posts, where we will take a closer look at supervised, unsupervised, and reinforcement learning, and discover how they can be used to drive progress and solve some of the most pressing challenges of our time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZPLsL26lJrka-ba2.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cc601e0bdbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Different Types of Data: Structured, Semi-Structured, and Unstructured Data]]></title>
            <link>https://medium.com/@sevdasanver/understanding-different-types-of-data-structured-semi-structured-and-unstructured-data-e91e81a0aade?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e91e81a0aade</guid>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Tue, 04 Apr 2023 05:47:23 GMT</pubDate>
            <atom:updated>2023-04-04T05:47:23.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XAAuUX3EWNbA_S53.png" /></figure><p>Data is the backbone of modern business and technology. However, not all data is created equal. In this article, we’ll explore the different types of data and why understanding them is important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/0*vjVrvD5MSbXdtB6i.png" /></figure><ol><li><strong>Structured Data:</strong> Structured data is highly organized and follows a specific schema or data model. Structured data is typically stored in a relational database or spreadsheet and can be easily queried and analyzed. Some examples of structured data include customer orders, inventory records, and financial statements. Structured data is easy to work with because it’s organized and follows a consistent format, which makes it easy to automate processes and generate insights.</li><li><strong>Semi-Structured Data:</strong> Semi-structured data is data that has some structure but doesn’t conform to a specific schema. Semi-structured data is typically found in formats such as XML or JSON, where data is organized in a hierarchical structure. Semi-structured data is commonly found in web applications and social media, where data is often unstructured but can be parsed into a semi-structured format for analysis. Some examples of semi-structured data include emails, social media posts, and log files. Semi-structured data requires additional processing and parsing to extract insights, but it’s still easier to work with than unstructured data.</li><li><strong>Unstructured Data:</strong> Unstructured data is data that has no specific structure or organization. Unstructured data is typically found in formats such as text, images, and videos, where the data is not organized in a consistent format. Unstructured data is challenging to work with because it requires significant preprocessing and analysis to extract insights. Some examples of unstructured data include emails, social media posts, and images. Unstructured data is becoming increasingly important in modern business and technology, as it contains valuable insights that can’t be found in structured or semi-structured data.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*60YaVgCPbOpK-Mdh.jpg" /></figure><p>In conclusion, understanding the different types of data is crucial for modern businesses and technology. <strong><em>Structured data</em></strong><em> is easy to work with and can be quickly analyzed to generate insights</em>, while <strong>semi-structured data</strong> requires additional processing to extract insights. <strong><em>Unstructured data</em></strong><em> is the most challenging to work with but contains valuable insights that can’t be found in structured or semi-structured data.</em></p><p>By understanding the different types of data and their strengths and weaknesses, businesses can make more informed decisions about how to collect, process, and analyze data to gain a competitive edge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e91e81a0aade" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Artificial intelligence (AI): Threats]]></title>
            <link>https://medium.com/@sevdasanver/artificial-intelligence-ai-threats-d4bff53e5a58?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4bff53e5a58</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 14:09:28 GMT</pubDate>
            <atom:updated>2023-01-28T14:33:07.700Z</atom:updated>
            <content:encoded><![CDATA[<p>Artificial intelligence is the technology that shapes the future of humanity. The use of AI technologies can make our life easier with tailored, cheaper, and longer-lasting products and services.</p><p>Or vice versa. It may provide a great power to change the world in a negative way, as well.</p><p>It is important to have a better understanding of what is AI and how AI algorithms function in order to be aware of its threats.</p><p>Artificial Intelligence is an innovative research field that applies human-like intelligence for solving complex and time-consuming problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*euQhvApo72obOvIH.gif" /></figure><p>AI combines an enormous amount of <strong>data</strong> with fast iterative processing. With the help of intelligent algorithms, it learns automatically from the <strong>patterns</strong> or <strong>features</strong> in the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*EjfY_cRheuAad2MF" /></figure><p>More specifically, we <strong>feed </strong>the machine learning algorithms <strong>with data</strong>, then let them examine the data, and in the end, they <strong>make conclusions</strong> about it. We also give them the opportunity to <strong>track</strong> and <strong>record</strong> a large amount of information about us, our daily life, our habits, etc. Thus, the possibility of <strong>being</strong> <strong>manipulated by AI </strong>becomes a <strong>potential threat</strong>, and our privacy starts to be <strong>vulnerable</strong> to these threats.</p><p>Some of us may think that tracking by AI systems should not a big problem. For instance, what would happen if Facebook tracks the content that we like or how many minutes we spend on what kind of videos, right?</p><p>In the end, they cannot control our minds. Right?</p><p><strong>Wrong.</strong></p><p>AI technologies can <strong>profile</strong> people and <strong>link</strong> individuals with certain types of beliefs and actions. If the AI system <strong>detects</strong> what we like to watch/read, it can recommend or display the <strong>“right content”</strong> to us. The content that we watched or read will have a big impact on our way of thinking, our political preferences, our behaviors, and our beliefs. The environment that they create may <strong>incorporate biases</strong> and have an <strong>influence</strong> on us by <strong>misleading </strong>and <strong>affecting</strong> our decisions.</p><p>So, yes, AI can control our minds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*FybGhuoAqfyos-UG.gif" /></figure><p>I will keep sharing about AI applications, machine learning&amp;deep learning, and data science.</p><p>Follow me for more content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4bff53e5a58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enumerate() — Python]]></title>
            <link>https://medium.com/@sevdasanver/enumerate-python-aa5e708f37f1?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa5e708f37f1</guid>
            <category><![CDATA[enumerate]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[function]]></category>
            <category><![CDATA[enumeration]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 23:50:04 GMT</pubDate>
            <atom:updated>2022-08-21T23:51:08.061Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*rcaG94xvSbffML16" /></figure><h3>Enumerate() — Python</h3><p>While dealing with iterations, we may need to get the index of elements. Enumerate() function produces the indexes of elements, and it can be used with the for loops.</p><p>Let’s see how enumerate works.</p><p>We will create a country list and find the indexes of elements with enumarate(). Then create a list with these elements and their indexes;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b55112fa2b8a8c9ac3066b07cb030ba/href">https://medium.com/media/4b55112fa2b8a8c9ac3066b07cb030ba/href</a></iframe><p><strong>Enumerate() with for loop:</strong></p><p>Let’s create a country list and generate their indexes with enumerate method by looping over the elements of the list. Here enumerate() helped us to go through each element and their indexes;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9755cd81f0991c826547767aaed6f1c2/href">https://medium.com/media/9755cd81f0991c826547767aaed6f1c2/href</a></iframe><p><strong>Changing default index</strong></p><p>As we know, indexes in python programming language start from 0. However, we may prefer the indexes we generate for each element starts from something else.</p><p>For the previous example, if we would prefer to give “5” as the default index of Afghanistan, we could have written our code as;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5179daf85ed7a2b2744d10d535027782/href">https://medium.com/media/5179daf85ed7a2b2744d10d535027782/href</a></iframe><p>We just added “5” inside of enumerate(). Simple, right?</p><p>Now, we can get the elements that has even indexes and put them in a new list. Then we can get the odd-indexed elements and put them in a second list. Let’s see what I mean by that;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6183de85bb5abeb2363518e4d04c0494/href">https://medium.com/media/6183de85bb5abeb2363518e4d04c0494/href</a></iframe><p><strong>How to write an alternating function with enumerate ()?</strong></p><p>I would like to write a function that capitalizes each elements of the even index of a sentence and make the letter lowercase of the odd indexes.</p><p>Here is my approach;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd3f8ef472cf427605c3f805ddf56992/href">https://medium.com/media/dd3f8ef472cf427605c3f805ddf56992/href</a></iframe><p>Here we learned enumarate method and practice it with some example.</p><p>Don’t forget to use it in your codes.</p><p><strong>The more practice you make, the better programming skills you have!</strong></p><p>See you next time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*8kkvTXZLVoFAYfyj" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa5e708f37f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Project- Example 4]]></title>
            <link>https://medium.com/@sevdasanver/python-project-example-4-ac9f25336130?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac9f25336130</guid>
            <category><![CDATA[python-projects]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 01:53:54 GMT</pubDate>
            <atom:updated>2022-06-21T01:53:54.258Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Preparation:</strong></p><p>Let’s assume our company’s HR department asks us to list the items that we need for improving our work efficiency. And imagine that we made this list;</p><p>Mandatory items: Laptop, Headset, Second monitor</p><p>Optional items: Mousepad, USB drive, External drive</p><p>Let’s create a list in Python and display it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/114f8d7d66392304a060493ed42c7af4/href">https://medium.com/media/114f8d7d66392304a060493ed42c7af4/href</a></iframe><p>How would you divide this list to show what is mandatory and what is optional?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e44e595490b640936146b1b2fe50c420/href">https://medium.com/media/e44e595490b640936146b1b2fe50c420/href</a></iframe><p><strong>Shopping List:</strong></p><p>Since we made a list, we can go shopping and purchase them!</p><p>After purchasing the items, we will submit the invoices to the finance department. But do not forget, the finance department confirmed a budget of $5000. Therefore, we can assign $5000 as the limit of our card and we can make sure that we would not exceed our limit.</p><p>By the way, I searched for the cheapest options and put them in a dictionary for you. You can see which item costs how much ;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/465dd489ecdfe22f3ae2f24ae4b6e7bd/href">https://medium.com/media/465dd489ecdfe22f3ae2f24ae4b6e7bd/href</a></iframe><p><strong>Shopping Functions:</strong></p><p>We need to define three functions that will help us during shopping.</p><ul><li>The first function will create an<em> empty list</em> that will be our shopping cart. Here, we will add the items that we need to buy.</li><li>Let’s define a function for adding items to the <em>cart </em>and removing those items from the <em>item_list</em>.</li><li>The<strong> “<em>add_to_cart</em>” function</strong> should take the <em>item name</em> and the <em>quantity</em> as an argument.</li><li>Define a function that will create an <em>invoice</em>.</li><li>The <strong>“<em>create_invoice</em>” function </strong>should calculate the taxes of each item (18%) and add it to the <em>total amount</em>.</li><li>Define a function for the <em>checkout</em>.</li><li>The <strong>“<em>checkout</em>” function </strong>should subtract the total amount from the budget and print a statement to inform if the payment was successful.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67c5990fdd79a283bfe600f4596d3170/href">https://medium.com/media/67c5990fdd79a283bfe600f4596d3170/href</a></iframe><p><strong>Time to buy:</strong></p><p>Let’s call <strong>add_to_chart</strong> function and buy our items. Then we can call checkout function to pay all and see how much we paid.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dadb1baa582033e56a2ef4d956b5b210/href">https://medium.com/media/dadb1baa582033e56a2ef4d956b5b210/href</a></iframe><blockquote>We just completed our task ! Yey!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*Zi-l5DDc4J4uuC5J.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac9f25336130" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning SQL for Data Science -1]]></title>
            <link>https://medium.com/@sevdasanver/learning-sql-for-data-science-1-7a515e02ab8d?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a515e02ab8d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[learn-sql]]></category>
            <category><![CDATA[structured-query-language]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 22:02:06 GMT</pubDate>
            <atom:updated>2022-06-18T22:02:06.659Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*dMMMz2sEJXcd7Yna.gif" /></figure><ul><li>SQL stands for <strong>Structured Query Language.</strong></li><li>SQL is a standard language for storing, manipulating, and retrieving data in databases.</li><li>It is designed for managing data in a relational database in the 1970s.</li><li>We can interact and communicate with data through SQL.</li><li>It is a quite simple but powerful tool.</li><li>Data analysts, data scientists, software developers, database developers, and quality assurance (QA) testers etc use SQL in their work.</li></ul><p><strong>Must-known terminologies:</strong></p><p><strong>Database:</strong> A database is a container that is usually a file(s) and is used to organize and store all of the data. It can be thought of as a filing system that has many cabinets that contain and organize all the data. DB can contain hundreds of tables and all those tables can be related to one another</p><p><strong>Relational database: </strong>A relational database is a database divided into logical units called tables, where tables are related to one another within the database. It allows data to be broken down into logical, smaller, and manageable units for easier maintenance and better performance.</p><p>In a relational database, we store data inside of something called a table.</p><p><strong>Tables:</strong> Tables are structured lists of data elements or specific data types. Tables in a DB are related to one another. If we look at the DB diagram, we can see those relations depicted with lines/arrows. From the diagram we can also see all table names, their columns and data types stored in each column</p><p><strong>Query: </strong>A query is a request for data or information from a database table or combination of tables. A query asks a database to return data in some form. In other words, each query is a piece of code that we write in SQL language.</p><p><strong>Statement:</strong> A statement is any text that the database engine recognizes as a valid command. It is basically a generic instruction to the database. This includes creating and dropping tables, inserting and deleting data, etc.</p><p><strong>NULL:</strong> It indicates that the data value in a specific table cell is missing or unknown. It’s important to not confuse null values with empty strings. NULL is not 0, and it does not mean empty! Null values are the absence of everything, whereas, in empty strings, there’s actually a value there. NULL occurs when the value in a given table cell is<strong> </strong>unknown or undetermined.NULL values, which mean that ‘in theory data exist, but it is not available in the DB.</p><p><strong>Primary Key: </strong>A primary key is a field in a table that uniquely identifies each row/record in a database table. Primary keys must contain unique values. A primary key column cannot have NULL values. A table can have only one primary key, which may consist of single or multiple fields.</p><p><strong>Temporary tables:</strong> They will be deleted when the current client session is terminated. They are useful because it is possible to create a table faster than <br>a real table. That is why if you have complex queries and you want to simplify it a bit by creating a subset, then temporary tables are a great option.</p><p><strong>SQL Syntax and Examples:</strong></p><p>Let’s start to write our first SQL statement. In order to retrieve the records such as employers’ names, hiring dates and salaries from our database, we usedSELECT keyword. Then we stated where should these information comes from by saying FROM employees table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-ekTcY2o2zPxmc58A0B9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bu6E6RGXts8lhddpXhfZZQ.png" /></figure><p><strong>Important note:</strong> SQL keywords are case-insensitive that means SELECT is same as select.</p><p><strong>SQL Comments:</strong></p><p>A comment is simply a text that is ignored by the database engine. It is very important to use because you or others who read it will understand what you were doing, and why you were doing it. Comments make the queries easy to understand.</p><p>By adding comments, you can also mute some expressions in your code and it’s going to help with troubleshooting your code and making your code easier to share overall.</p><p>There are 2ways for commenting;</p><p>Single line comments; Using two consecutive hyphens (- -)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNLPbRj5eNVJ43B_ePajjw.png" /></figure><p>Sectional (multi-line) comments; start the comment with a slash followed by an asterisk (/*) and end the comment with an asterisk followed by a slash (*/) (/* … */)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9c6OkPFAqMe5j5Ec0ewwUw.png" /></figure><p>Here we used * after SELECT, * means select “all” columns from a table. FROM clause specifies the table that we want to query. WHEREis used to filter records. It is used to extract only those records that fulfill a specified condition.</p><p><strong>Creating Database:</strong></p><p>Before doing anything with the data, we need to create a database first.</p><p>CREATE DATABASE testDB;</p><p>We created a database called as testDB.</p><p><strong>Creating Table:</strong></p><p>The CREATE TABLE statement is used to create a new table in a database.</p><blockquote>CREATE TABLE <em>table_name </em>(<br><em> column1 datatype</em>,<br><em> column2 datatype</em>,<br><em> column3 datatype</em>,<br> ….<br>);</blockquote><p>Here, the “<strong>column1</strong>” (2 and 3) parameters specify the names of the columns of the table.</p><p>The “<strong>datatype</strong>” parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LTCavdDfUBTXfr-8CGnL5w.png" /></figure><p>Our “Person” table includes 4 columns. The first column is “<strong>PersonID</strong>” is of type <strong>int</strong> and will hold an <strong>integer</strong>.</p><p><strong>“The LastName”, “FirstName”, “Address”,</strong> and <strong>“City”</strong> columns are of type <strong>varchar </strong>and will hold <strong>characters</strong>, and <em>the maximum length</em> for these fields is <em>255 characters</em>.</p><p>The following table summarizes the most commonly used data types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVsKHB2nnsS6nOzsWy96wA.png" /></figure><p>Let’s use what we learned until now.</p><ul><li>Create a database called Bakery.</li><li>Let’s add two tables to the database. One should be called ‘Sweet’ and the one should be called ‘Savoury’</li><li>The Sweet table should have three columns: id (which is a number), item_name (name of a pastry) and price (prices can be expressed in pound and pennies)</li><li>Include the same columns in the Savoury table. In addition, add a column called main_ingredient.<br>So we try to make our tables like;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*equCX9MJk9F-YhA2PypIug.png" /></figure><p>Okay.</p><p>Let’s start;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DowBnhWPc21VCu5Lx2HBxA.png" /></figure><p>We created a database named “Bakery” and created 2 tables in it which are “Sweet” and “Savour” tables. The sweet table has id, item_name, and price columns. The first column “id” is an integer and the third column “price” is float value. “Item_name” column holds characters. The savour table has the same columns except “main_ingredient”.</p><ul><li>I will use MySQL, which is an open-source relational database management system</li><li>I also will use <strong>MySQL Workbench</strong> — a visual database design tool that would help us to perform tasks when working with databases. You can download it to your computer as well.</li><li>Or, you can practice here by selecting SQL; <a href="https://coderpad.io/sandbox">https://coderpad.io/sandbox</a></li></ul><blockquote>Next time we will continue to learn SQL and make more practice!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*evr5dXAPODdqMZiH.gif" /></figure><p><strong>References:</strong></p><p><a href="https://www.w3schools.com/sql/default.asp">https://www.w3schools.com/sql/default.asp</a>.<br><a href="https://www.tutorialrepublic.com/sql-tutorial/">https://www.tutorialrepublic.com/sql-tutorial/</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a515e02ab8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Examples-3]]></title>
            <link>https://medium.com/@sevdasanver/python-examples-3-199a68f2272b?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/199a68f2272b</guid>
            <category><![CDATA[python-beginner]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-example]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 04:03:36 GMT</pubDate>
            <atom:updated>2022-06-18T04:04:13.735Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*UZSOZP2ddnryde3U.gif" /></figure><p>Are you ready for solving some questions??!! Let’s start with an easy one.</p><ol><li>Get this list; [0,1,2,3,4,5,6,7,9,10,12] and</li></ol><p>Print the values between 3rd and 6th index.<br>Reverse the list.<br>Add “15,16,17” values to the list. <br>After the 5th index, add 50 and 51.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/850587c0e6cde4c19f64f6e17ba225ad/href">https://medium.com/media/850587c0e6cde4c19f64f6e17ba225ad/href</a></iframe><p>2. Write a function that takes some inputs and finds the summation of those inputs. (You do not know how many variables will be entered.)</p><p>For example, when you call sumAll(1,5,6,7,6,2), you will find 27 because 5 + 6 + 7 + 6 + 2 = 27.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e200a2d5d930311c8616d9d73496cad/href">https://medium.com/media/9e200a2d5d930311c8616d9d73496cad/href</a></iframe><p>3. Create a function and name it as “sumOddIndex”. You will get some values and find the sum of all values only in the odd index numbers. Then you need to print it on the screen. <br>For example, when you call sumOddIndex([5,10,15,30,1,2,3]), you need to find 42 as a result of 10 + 30 + 2 summation. Here are 3 approaches to do it;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ebb1a27cebb95a40019fb3357359deb/href">https://medium.com/media/7ebb1a27cebb95a40019fb3357359deb/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/961aed2effd1a3843abe4c9881940fcf/href">https://medium.com/media/961aed2effd1a3843abe4c9881940fcf/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c24aef4f1728bc9e900fd955a3a2661/href">https://medium.com/media/8c24aef4f1728bc9e900fd955a3a2661/href</a></iframe><p>4. User will enter a min_num, max_num, and n_num. (n_num defines how many values would you like to generate between min_num and max_num.)</p><p>Create n numbers between min_num and max_num, and then print them in a list format.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6f84f3e3bfe042b44a608472c9dc001/href">https://medium.com/media/a6f84f3e3bfe042b44a608472c9dc001/href</a></iframe><p>5. Follow the same process with question 4 and return another list that consists of the cumulative sum of numbers you generated.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97b751d522f53d717213ab0bbaeb71ea/href">https://medium.com/media/97b751d522f53d717213ab0bbaeb71ea/href</a></iframe><p>6. Think about the all numbers between 0 to 9. Which ones are missing in this list [9,4,5,6,1,2]? How many elements are missing in this list?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7468100f88bb3b14a2a786e9fa8daefa/href">https://medium.com/media/7468100f88bb3b14a2a786e9fa8daefa/href</a></iframe><p>7. We have a similar question to the above one. You are given this list [9,8,7,0,4,5,6,1,2]. There is only one element missing in the range of 0 to 9. How would you find this missing value?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3981e782c1aa73686a4faa24ba32e378/href">https://medium.com/media/3981e782c1aa73686a4faa24ba32e378/href</a></iframe><blockquote>That was all for this week! <br>See you next time!!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*JP4ZkklaQT_1Qcy3.gif" /></figure><blockquote><em>I am one of the participants of the SistersLab’s Women in Tech Academy which is supported by the organization “Toplum Gönüllüleri Vakfı” (</em><a href="https://www.tog.org.tr/en/"><em>https://www.tog.org.tr/en/</em></a><em>). The project aims to empower 25 women with software training and support them to participate in the workforce in the IT sector. I am very happy for getting a chance to be a part of this team. You can find more information about the project here: </em><a href="https://sisterslab.co/women-in-tech-academy/"><em>https://sisterslab.co/women-in-tech-academy/</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=199a68f2272b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Structures — Tuples]]></title>
            <link>https://medium.com/@sevdasanver/tuples-958768423779?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/958768423779</guid>
            <category><![CDATA[tuples-in-python]]></category>
            <category><![CDATA[tuples]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Sun, 12 Jun 2022 05:43:18 GMT</pubDate>
            <atom:updated>2022-07-25T23:10:09.118Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Hello. I am one of the participants of the SistersLab’s Women in Tech Academy which is supported by the organization “Toplum Gönüllüleri Vakfı” (<a href="https://www.tog.org.tr/en/">https://www.tog.org.tr/en/</a>). The project aims to empower 25 women with software training and support them to participate in the workforce in the IT sector. I am very happy for getting a chance to be a part of this team. You can find more information about the project here: <a href="https://sisterslab.co/women-in-tech-academy/">https://sisterslab.co/women-in-tech-academy/</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*B_LzY1WIzqNgYP0e.gif" /></figure><h3>Data Structures — Tuples</h3><ul><li>Tuples are also immutable (unchangeable). After they are created, we cannot add or delete any element. When we try to change anything, we will get this error:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/142254212438e1d27e4461bccb05e04e/href">https://medium.com/media/142254212438e1d27e4461bccb05e04e/href</a></iframe><ul><li>They are ordered. It means that we can reach the elements with their indexes.</li><li>We can define them with parenthesis <strong>() </strong>and<strong> </strong>use<strong> “,” </strong>between elements.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f3d6e77fa786e3996ac0c7770a0bf8e/href">https://medium.com/media/4f3d6e77fa786e3996ac0c7770a0bf8e/href</a></iframe><p>As we can see above, tuples can contain different types of objects, lists, or duplicated objects.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cebeb8464e364f65d4088d8d513b4d6e/href">https://medium.com/media/cebeb8464e364f65d4088d8d513b4d6e/href</a></iframe><p>Here is such an interesting feature of tuples. We can define tuples <strong>without parenthesis</strong>, as well. It is okay just to write the items separated by commas.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adf766b669702f76d46efe66120885a0/href">https://medium.com/media/adf766b669702f76d46efe66120885a0/href</a></iframe><p>In this example, we defined our tuple, then assign it to name, year, and male variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6f84cf8ec650c96158ebb39c72299af/href">https://medium.com/media/e6f84cf8ec650c96158ebb39c72299af/href</a></iframe><p>We can use range and len functions with tuples.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c164001e251a7ee3958f579a1b499e71/href">https://medium.com/media/c164001e251a7ee3958f579a1b499e71/href</a></iframe><p>Here we can see the examples of indexing and slicing. In line 9, we commanded in the code that skip every other numbers and because we said it is <strong>-</strong>2 (negative part is important here) , start from end and go back to beginning.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dac97c8545143f11fd2ed0f558992f98/href">https://medium.com/media/dac97c8545143f11fd2ed0f558992f98/href</a></iframe><p>In order to see the index of the element, we can use <strong>.index()</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4ab8d6c6d3119ef2e593016adca43c4/href">https://medium.com/media/c4ab8d6c6d3119ef2e593016adca43c4/href</a></iframe><p>Look at line 2. Did you see (<strong>2,</strong> 4, 7) part? Our code will find the element 2 , between 4th and 7th index. And then because of the .index() part, it will give us the index of 2 which is 5. <br>(The format we used here is: tuple.index(element, start, end))</p><p>What if we want to make a change in a tuple? Easy. We can convert the type from a tuple to a list, make any change on the list, and we can convert it back to the tuple.</p><p>Smart, right?! 😊</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72c0be4ba4162a0a847b27da9d3e5956/href">https://medium.com/media/72c0be4ba4162a0a847b27da9d3e5956/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fc57afec88f7c001e9a51d6dfc554cf/href">https://medium.com/media/5fc57afec88f7c001e9a51d6dfc554cf/href</a></iframe><p>As we said we cannot change tuples because they are immutable; however, we an change lists inside of the tuple! In this example, we reached the first element which is in index 0 and changed it to 8.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c9bb124cbb8bab304d42bfef0852393/href">https://medium.com/media/3c9bb124cbb8bab304d42bfef0852393/href</a></iframe><p>It was our last example. We used <strong>“+”</strong> operator for combining two tuples.</p><blockquote>So far, we learned about variables, operators, if-else statements, for loops, while loops, lists, filter(), map(), lambda functions, tuples, and a lot of built-in functions.</blockquote><blockquote>We will keep learning Python and solve lots of questions for better understanding.</blockquote><blockquote>See you next time with new topics !</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*racfRCOPzrnFf7Sb.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=958768423779" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Structures — Lists]]></title>
            <link>https://medium.com/@sevdasanver/python-lists-cd8938fc1617?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd8938fc1617</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[lists]]></category>
            <category><![CDATA[python-list]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 05:31:35 GMT</pubDate>
            <atom:updated>2022-07-25T23:10:35.488Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Hello. I am one of the participants of the SistersLab’s Women in Tech Academy which is supported by the organization “Toplum Gönüllüleri Vakfı” (</em><a href="https://www.tog.org.tr/en/"><em>https://www.tog.org.tr/en/</em></a><em>). The project aims to empower 25 women with software training and support them to participate in the workforce in the IT sector. I am very happy for getting a chance to be a part of this team. You can find more information about the project here: </em><a href="https://sisterslab.co/women-in-tech-academy/"><em>https://sisterslab.co/women-in-tech-academy/</em></a></blockquote><p>There are 4 data structures in python called lists, dictionaries, tuples, and sets. I will start with lists to explain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*Ya3ypYX45KYKeQFx.png" /></figure><p>We use lists to store multiple items in a single variable.</p><p>Items in lists are mutable (changeable), ordered, and can store duplicated values. Lists can contain different types of variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58f0119a665dc9b7f6bf1983d3814602/href">https://medium.com/media/58f0119a665dc9b7f6bf1983d3814602/href</a></iframe><p>We also used <strong>len() </strong>function here in order to see the length of the list.</p><p>We can reach at the elements of a list by “<strong>listName[indexNumber]</strong>”. The index of the first element of the list is 0.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7cb2da79268144f78df34b2c088e471/href">https://medium.com/media/d7cb2da79268144f78df34b2c088e471/href</a></iframe><p>In this example, <strong>colors[1]</strong> gives us <strong>‘blue’</strong>.</p><p>If we have nested lists, we can reach out the inner elements as;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94495e141f11ce16175b9d89289ad5b4/href">https://medium.com/media/94495e141f11ce16175b9d89289ad5b4/href</a></iframe><p><strong>my_list[3][0]</strong> let us to get the first element which is of index 0 of the nested list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b590438fffd34a77afd218484878069/href">https://medium.com/media/2b590438fffd34a77afd218484878069/href</a></iframe><p><strong>my_list[1:4]</strong> means the elements from index 1 to index 3 which are <strong>“2,3,5”.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8524850fcb61ade65f6a7a63a0b91d37/href">https://medium.com/media/8524850fcb61ade65f6a7a63a0b91d37/href</a></iframe><p>In this example, we used <strong>range() </strong>function in order to loop over out list with the help of<strong> len() </strong>function.</p><h3><strong>List Methods:</strong></h3><p><strong>Removing elements:</strong></p><p>There are a couple of methods that we can use to <strong>remove</strong> the element(s) from a list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a978ae4637f464f86841cc8f02a3dd78/href">https://medium.com/media/a978ae4637f464f86841cc8f02a3dd78/href</a></iframe><p><strong>Joining two lists:</strong></p><p>If we would like to <strong>join</strong> two lists, we can simply use one of these methods:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/396d186a01c31958994824d5a31b69b4/href">https://medium.com/media/396d186a01c31958994824d5a31b69b4/href</a></iframe><p>To sum up, we can add two lists with “<strong>+”</strong> operator, or we can use <strong>.extend() </strong>method, or we can use the <strong>.append()</strong> method.</p><p><strong>Copying of a list:</strong></p><p>We can copy a list by assigning it to a new one with the <strong>.copy() </strong>method. Sometimes people say we can copy lists with the assignment operator <strong>“=”</strong>. However, we should be careful, there is a difference between using .<strong>copy()</strong> and using <strong>“=”</strong></p><p><strong>WARNING:</strong> We need to keep in mind that assignment with an “=” on lists does not make a copy of a list. Instead, assignment makes the two variables point to the one list in memory. It means <em>they basically occupy the same space in the memory.</em></p><p>Let’s see it with an example. We will create a “colors” list as;</p><p>colors = [‘red’, ‘blue’, ‘green’]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q40Y8MOuokIcVNdO0ewvfA.png" /></figure><p>then assign colors to b;</p><p>b=colors</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtI8TYAzZkkkHbVm1zlmFA.png" /></figure><p>As we see, they occupy the same place in the memory. <strong><em>When we make any change on the b list, the colors list will be changed, and vice versa.</em></strong></p><p>Clear right?</p><p>Let’s add some new colors to the colors list and b list and see that how the changes in one list will affect the other one as we explained above;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9806775e9b16bd8d51623b919f7057b/href">https://medium.com/media/a9806775e9b16bd8d51623b919f7057b/href</a></iframe><p>Now we can see how the <strong>.copy()</strong> method works;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f54b6d85e6556a23f87a9c4a7f8c6be/href">https://medium.com/media/5f54b6d85e6556a23f87a9c4a7f8c6be/href</a></iframe><p>In the line 4, we add “4” to list. It did not change <strong>new_list </strong>as we can see in line 5(and line14). It only changed <strong>list </strong>(line 6 and 15).</p><p>Similarly, when we add “5” to the <strong>new_list</strong> in line 8, it did not change the <strong>list</strong>. It only changed the <strong>new_list</strong>.</p><p>Some other methods such as <strong>.sort() , .reverse() , max() , min() , sum() </strong>;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25f02f8f2c823e0bb4d222d41cc7520b/href">https://medium.com/media/25f02f8f2c823e0bb4d222d41cc7520b/href</a></iframe><p>We have a text message (“<em>Thank you Sisterslab Women in Tech Academy</em>”) and we would like to create a list from this text with the words that have more than 4 letters. How would you do that?</p><p>Think a bit before reading the code.</p><p>Ready? Okay, here we go;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d300f7c0475bdb6999a3f67438936ef1/href">https://medium.com/media/d300f7c0475bdb6999a3f67438936ef1/href</a></iframe><p>We used .<strong>split()</strong> method here. This method breaks up a string at the specified separator and returns a list of strings.</p><p>And this example is about removing same values from our list;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00c3877658d41dec02a213437d411023/href">https://medium.com/media/00c3877658d41dec02a213437d411023/href</a></iframe><p>Try to understand how we used “<strong>not in</strong>” in if-statement. And <strong>“in”</strong> in the next example;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/370c91c6b23e91103309a367c9f0a5d0/href">https://medium.com/media/370c91c6b23e91103309a367c9f0a5d0/href</a></iframe><p><strong>“in”</strong> and <strong>“not in”</strong> is quite useful and we will keep seeing them in our codes.</p><blockquote>Yeap. It is the end of the Python list and list methods.</blockquote><blockquote>Great, you made it!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*I_iJcVW1Xwua81zj.gif" /></figure><p><strong>Sources:</strong></p><p>Women in Tech Academy notes<br><a href="https://www.w3schools.com/">https://www.w3schools.com/</a> <a href="https://developers.google.com/edu/python/lists">https://developers.google.com/edu/python/lists</a> <a href="https://www.tutorialspoint.com/python/index.htm">https://www.tutorialspoint.com/python/index.htm</a> <br><a href="http://www.geeksforgeeks.org/">www.geeksforgeeks.org</a><br><a href="https://www.programiz.com/python-programming">https://www.programiz.com/python-programming</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd8938fc1617" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python- Lambda(), Filter() and Map() Functions]]></title>
            <link>https://medium.com/@sevdasanver/python-lambda-function-a92400ec656d?source=rss-fdce6a1b214f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a92400ec656d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[learn-python]]></category>
            <category><![CDATA[filter-function]]></category>
            <category><![CDATA[map-function]]></category>
            <dc:creator><![CDATA[Sevda Sanver]]></dc:creator>
            <pubDate>Tue, 07 Jun 2022 04:29:04 GMT</pubDate>
            <atom:updated>2022-06-08T03:26:24.861Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Hello. I am one of the participants of the SistersLab’s Women in Tech Academy which is supported by the organization “Toplum Gönüllüleri Vakfı” (<a href="https://www.tog.org.tr/en/">https://www.tog.org.tr/en/</a>). The project aims to empower 25 women with software training and support them to participate in the workforce in the IT sector. I am very happy for getting a chance to be a part of this team. You can find more information about the project here: <a href="https://sisterslab.co/women-in-tech-academy/">https://sisterslab.co/women-in-tech-academy/</a></blockquote><h3>Python- Lambda(), Filter() and Map() Functions</h3><p>The Lambda function is an anonymous function, meaning that the function is without a name.</p><p>The <strong>lambda</strong> keyword is used to define the anonymous function in Python similar to the<strong> def</strong> keyword used for defining a normal function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*swn6MX1a2BxID9BA.gif" /></figure><p>So, we can express this code →</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3cdce6c1069efcf26c16455ba5e00266/href">https://medium.com/media/3cdce6c1069efcf26c16455ba5e00266/href</a></iframe><p>in this format (with lambda function) →</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b694c0b34a98b9acbdd2c9d1e629e28b/href">https://medium.com/media/b694c0b34a98b9acbdd2c9d1e629e28b/href</a></iframe><p>As we see, lambda function lets us to create small, single-use function, and it saves time and space in our code.</p><p>In this example, we can read the first line as ‘ multiply x with 2 and return the result’;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5c1e20a3e652bc4d4e0595368f7935b/href">https://medium.com/media/c5c1e20a3e652bc4d4e0595368f7935b/href</a></iframe><p>We can define max function and use an if-else statement like;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd8a825f7d709e158bcb618c063e557e/href">https://medium.com/media/cd8a825f7d709e158bcb618c063e557e/href</a></iframe><p>Or we can write the same code as;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07a6d4210168a5b10d694c8c59f4a01e/href">https://medium.com/media/07a6d4210168a5b10d694c8c59f4a01e/href</a></iframe><p>The only thing we need to keep in mind is that <strong>x </strong>comes before “<strong>if x&gt;y</strong>” contrary to expectations in the second code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d150cf6adf16767b59610a7d92e627fa/href">https://medium.com/media/d150cf6adf16767b59610a7d92e627fa/href</a></iframe><p>Here, we created a<strong> new_list</strong> function in the third line. However, the type of it is <strong>‘<em>function</em>’</strong>(check out the lines 5 and 10).<br>In order to convert it to a list, we need to use the <strong>list()</strong> function as in line 6.</p><p>In this code, we can sort each sublist as:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d42b2420bacb66c91b4cc26e1181bc47/href">https://medium.com/media/d42b2420bacb66c91b4cc26e1181bc47/href</a></iframe><p>The <strong>sorted()</strong> function returns a sorted list of the specified iterable object.</p><p>Lambda functions can be used along with <strong>built-in functions</strong> such as<strong> filter()</strong> or <strong>map().</strong></p><p>Using<strong> lambda()</strong> function with <strong>filter()</strong></p><p>Filter() function, combined with a lambda function, filters out all the elements of a sequence “sequence”, for which the function returns True.</p><p>In other words, filter() forms a new list that contains only elements that satisfy a certain condition, i.e. the function we passed returns True.</p><p>In this example, we printed the odd numbers of ‘my_list’ by using lambda function with filter:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37c00c526a7a7be9fad15d073d60ffbc/href">https://medium.com/media/37c00c526a7a7be9fad15d073d60ffbc/href</a></iframe><p>Using<strong> lambda()</strong> function with <strong>map()</strong></p><p>The map () function iterates through all items in the given iterable and executes the function we passed as an argument on each of them. Or we can define map() function as: the map() function is called with a lambda function and a list and a new list is returned which contains all the lambda modified items returned by that function for each item.</p><p>This code prints TRUE for even numbers, FALSE for odd numbers:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5bf14d3d8a1930293905f6324dc9b3b0/href">https://medium.com/media/5bf14d3d8a1930293905f6324dc9b3b0/href</a></iframe><p>Let’s see some examples of filter and map functions to understand their concepts.</p><p>Define a mixed type list and find the integers in the list by using <strong>filter()</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d36a5fbd867b652a9b441de52397fa9e/href">https://medium.com/media/d36a5fbd867b652a9b441de52397fa9e/href</a></iframe><p>Let’s multiply the first element of each lists with 3 and return it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a9364445e8b49413a3011dfc32cd17b/href">https://medium.com/media/5a9364445e8b49413a3011dfc32cd17b/href</a></iframe><p>We can capitalize the strings we have in our list with <strong>.capitalize() </strong>function or we can use <strong>.upper()</strong> function to print them in capital letters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dee47276435dab84b0cf3145072b7453/href">https://medium.com/media/dee47276435dab84b0cf3145072b7453/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3a85791138da6179f4ec67706e00c4c/href">https://medium.com/media/c3a85791138da6179f4ec67706e00c4c/href</a></iframe><p>Let’s find the numbers bigger than 20 in our list. Then use map() function and divide them to 10 and get integer results. (Line 2 and 3 express the same thing.)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3944b8dd9b77780815f3c17a01983435/href">https://medium.com/media/3944b8dd9b77780815f3c17a01983435/href</a></iframe><p>To sum up the differences of filter() and map() functions, we can say that;</p><ul><li><strong>If we would like to do a mathematical operation with <em>every single element</em> of a list and then <em>create a new list with new results</em> → we use <em>map</em>.</strong></li><li><strong>If we have a criteria + check the elements of the list for that criteria, then make <em>a new list</em> <em>with the ones which meets the criteria </em>→ we use filter.</strong></li></ul><p>- If we would like to check a condition is true or false, we use filter. <br>-If we would like to see some of the outputs(not all), we use filter.</p><blockquote>This was all for this week. We learned lambda, filter and map functions today. See you next time!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2n8nm-JacTCEFkxU.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a92400ec656d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>