<?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 SHARMITHA AR on Medium]]></title>
        <description><![CDATA[Stories by SHARMITHA AR on Medium]]></description>
        <link>https://medium.com/@sharmitharam2000?source=rss-e646a2433ab2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6SuA5_aJJpEKBvUz</url>
            <title>Stories by SHARMITHA AR on Medium</title>
            <link>https://medium.com/@sharmitharam2000?source=rss-e646a2433ab2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 28 May 2026 17:08:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sharmitharam2000/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[SQL]]></title>
            <link>https://medium.com/@sharmitharam2000/sql-2857aceeb175?source=rss-e646a2433ab2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2857aceeb175</guid>
            <dc:creator><![CDATA[SHARMITHA AR]]></dc:creator>
            <pubDate>Sat, 13 Apr 2024 16:47:24 GMT</pubDate>
            <atom:updated>2024-04-13T16:47:24.680Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Some Expected Interview Questions On SQL</strong></h3><p>SQL (Structured Query Language) is the cornerstone of modern data management and manipulation.</p><p><strong>What is SQL and what are its main components?</strong></p><ul><li>SQL (Structured Query Language) is a domain-specific language used to manage and manipulate relational databases. Its main components include:</li><li>DDL (Data Definition Language): Used to define and modify the structure of database objects like tables, indexes, and views (e.g., CREATE, ALTER, DROP).</li><li>DML (Data Manipulation Language): Used to manipulate data within the database, including querying, inserting, updating, and deleting data (e.g., SELECT, INSERT, UPDATE, DELETE).</li><li>DCL (Data Control Language): Used to control access to data within the database (e.g., GRANT, REVOKE).</li><li>TCL (Transaction Control Language): Used to manage transactions within the database (e.g., COMMIT, ROLLBACK).</li></ul><p><strong>Explain the different types of SQL joins.</strong></p><ul><li>INNER JOIN: Returns only the rows that have matching values in both tables.</li><li>LEFT JOIN (or LEFT OUTER JOIN): Returns all rows from the left table, and the matched rows from the right table. If there is no match, NULL values are returned for the right table.</li><li>RIGHT JOIN (or RIGHT OUTER JOIN): Returns all rows from the right table, and the matched rows from the left table. If there is no match, NULL values are returned for the left table.</li><li>FULL JOIN (or FULL OUTER JOIN): Returns all rows from both tables, with NULL values for unmatched rows.</li></ul><p><strong>What is normalization and why is it important in databases?</strong></p><p>Normalization is the process of organizing data in a database to reduce redundancy and dependency by breaking large tables into smaller, related tables. It helps maintain data integrity, reduces storage space, and minimizes update anomalies. Normalization is essential for efficient database design and ensures that the database schema is flexible and scalable.</p><p><strong>What is Denormalization ?</strong></p><p>Denormalization is the opposite of Normalization. Where as denormalization is a technique used to access the data from higher to lower form of the database. Where the redundant data is added to speedup complex queries by joining the multiple table</p><p><strong>What is an index in SQL and why is it used?</strong></p><p>An index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional space and slower writes. It is used to quickly locate rows in a table based on the values of one or more columns. Indexes are crucial for optimizing query performance, especially for large datasets, by reducing the number of rows that need to be scanned during query execution.</p><p><strong>Explain the ACID properties in database transactions.</strong></p><ul><li>ACID stands for Atomicity, Consistency, Isolation, and Durability, which are the four key properties that ensure the reliability and integrity of database transactions:</li><li>Atomicity: Ensures that a transaction is treated as a single, indivisible unit of work, either fully completed or fully aborted.</li><li>Consistency: Ensures that a transaction brings the database from one consistent state to another consistent state, preserving data integrity and constraints.</li><li>Isolation: Ensures that the execution of transactions is isolated from one another, preventing interference and ensuring that transactions appear to execute serially.</li><li>Durability: Ensures that once a transaction is committed, its effects are permanently saved and survive system failures, ensuring data persistence.</li></ul><p><strong>What is a subquery and how is it different from a join?</strong></p><p>A subquery is a query nested within another query and enclosed within parentheses. It can be used to retrieve data from one or more tables and can be used in SELECT, INSERT, UPDATE, or DELETE statements. A subquery can return a single value, a single row, multiple rows, or even a table. In contrast, a join is used to combine rows from two or more tables based on a related column between them.</p><p><strong>Explain the difference between GROUP BY and HAVING clauses.</strong></p><p>The GROUP BY clause is used to group rows that have the same values into summary rows, typically used with aggregate functions like SUM, COUNT, AVG, etc. The HAVING clause, on the other hand, is used to filter the results of a GROUP BY clause based on specified conditions applied to the grouped data. While the WHERE clause filters rows before grouping, the HAVING clause filters groups after grouping.</p><p><strong>How do you handle NULL values in SQL queries?</strong></p><p>NULL values in SQL queries can be handled using functions like IS NULL, IS NOT NULL, COALESCE, or IFNULL to check for NULL values in columns or expressions. Additionally, you can use the CASE statement to handle NULL values conditionally in SELECT queries or use the NULLIF function to replace NULL values with a specified default value.</p><p><strong>Explain the difference between a clustered and a non-clustered index.</strong></p><p>A clustered index determines the physical order of data rows in a table based on the indexed column(s). Each table can have only one clustered index, and it directly affects the order of data storage on disk. In contrast, a non-clustered index does not affect the physical order of data rows and stores a separate data structure containing pointers to the actual data rows.</p><p><strong>What is a primary key and why is it important?</strong></p><ul><li>A primary key is a unique identifier for each record in a table. It ensures that each row in the table is uniquely identifiable and provides a reference point for relationships between tables. Primary keys enforce entity integrity and help maintain data consistency.</li></ul><p><strong>What is a foreign key and how is it used?</strong></p><p>A foreign key is a column or a set of columns in a table that establishes a relationship with a primary key or a unique key in another table. It enforces referential integrity by ensuring that values in the foreign key column(s) correspond to values in the referenced primary key column(s) in the related table.</p><p><strong>Explain the difference between UNION and UNION ALL operators.</strong></p><p>The UNION operator is used to combine the results of two or more SELECT queries into a single result set, removing duplicate rows. The UNION ALL operator, on the other hand, also combines the results of multiple SELECT queries but retains all rows, including duplicates, from each query result.</p><p><strong>What is a trigger and when would you use it?</strong></p><p>A trigger is a special type of stored procedure that automatically executes in response to certain database events, such as INSERT, UPDATE, or DELETE operations on a table. Triggers are used to enforce business rules, maintain data integrity, and automate tasks such as auditing or logging changes to data.</p><p><strong>Explain the difference between a clustered and a non-clustered index.</strong></p><p>A clustered index determines the physical order of data rows in a table based on the indexed column(s). Each table can have only one clustered index, and it directly affects the order of data storage on disk. In contrast, a non-clustered index does not affect the physical order of data rows and stores a separate data structure containing pointers to the actual data rows.</p><p><strong>What is a self-join and how is it used?</strong></p><p>A self-join is a type of join where a table is joined with itself. It is used to combine rows from the same table based on a related column or condition within the table. Self-joins are useful for hierarchical or recursive queries, such as finding managers and their direct reports in an employee table.</p><p><strong>What is the difference between a view and a table?</strong></p><p>A table is a database object that stores data in rows and columns, while a view is a virtual table derived from one or more tables or views. Unlike tables, views do not store data themselves; instead, they represent the result set of a predefined SQL query. Views provide a way to simplify complex queries, enforce security, and abstract data access.</p><p><strong>Explain the purpose of the COMMIT and ROLLBACK statements.</strong></p><p>The COMMIT statement is used to permanently save the changes made by a transaction to the database, making them visible to other transactions. The ROLLBACK statement, on the other hand, is used to undo the changes made by a transaction and restore the database to its state before the transaction began. COMMIT and ROLLBACK statements are essential for ensuring transactional consistency and integrity.</p><p><strong>Type of Normalization in detail</strong></p><p>We have 4 types of Normalization</p><ol><li>First Normal Form [1NF] 2. Second Normal Form [2NF] 3. Third Normal Form [3NF] 4. Boyce Codd Normal Form [BCNF]</li></ol><p><strong>First Normal Form [1NF] </strong>:- Each table cell should have a single value. So, Basically all the records must be unique</p><p><strong>Second Normal Form[2NF] </strong>:- To use Second Normal Form it should satisfy 1st Normal Form and Should also have single column Primary Key.</p><p><strong>Third Normal Form [3NF] :</strong>- To use Third Normal Form It should satisfy 2nd Normal Form and Must Not have any transitive functional dependency [Every Attribute should be dependent on Primary key because there should no partial dependency of the data]</p><p><strong>Boyce Codd Normal Form [BCNF] :</strong>- If your Database is in 3rd Normal Form, Then there would be some scenarios where anomalies would be present. If you have more than one candidate key then BCNF comes into picture, Where you divide your table further, So that there would be only one candidate key present.</p><p><strong>What is Entity-Relationship ?</strong></p><p>Data Model Entity Relation data Model is based on the Notion of real-word Entities and relationship between them. Note:- Notion:- Notion is an all in one relationship, Where you can write, Plan, Collaborate and get organized <strong>Entity :</strong>- An Entity is an easily recognizable living or non-living real word object Ex:- Student, Customer, Product. Relationship :- Relationship is an association between two entities. Ex:- A Customer Buys a Product</p><p><strong>What is Schemas and explain type of Schemas</strong></p><p>A database Schema is a skeleton structure that represents the logical view of the database. It defines its entities and relationship between them. — The Database Schema is categorized into 2 types</p><ol><li>Physical Schema 2. Logical Schema</li></ol><p>Physical Schema :- Physical Schema represents actual storage of the data Logical Schema :- Logical Schema represents the logical constraints, That need to be applied to the data stored It may define Integrity constraints, Views and Table.</p><p><strong>What are Views in MySQL ?</strong></p><p>View is a virtual table that do not store any data of their own but display the data stored in other tables. You will not have to create complex queries involving joins repeatedly Views helps in data security. You can use view to show only authorized information to the user and hide the sensitive information</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2857aceeb175" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AtliQ Sales Insights]]></title>
            <link>https://medium.com/@sharmitharam2000/atliq-sales-insights-16341ce1f849?source=rss-e646a2433ab2------2</link>
            <guid isPermaLink="false">https://medium.com/p/16341ce1f849</guid>
            <dc:creator><![CDATA[SHARMITHA AR]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 17:43:19 GMT</pubDate>
            <atom:updated>2024-02-22T17:43:19.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*ZlJaAos3qr2bKuTqpGqSDQ.png" /></figure><h3>Introduction</h3><ul><li>In this project I’ve simulated a business problem resolution to a hardware company in India.</li><li>Is a company which supplies computer hardware and peripherals to many clients across India.(like Excel store , Nomad store etc.</li></ul><p><strong>Business Issue</strong></p><ul><li>The sales director is facing a lot of challenges such as:</li><li>The marketing is growing dynamically and then he’s struggling in terms of tracking the sales, needing more accurate insights about the company sales, and then take the necessary decisions.</li></ul><h3><strong>Aims Grid</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4rNMq-MeI2LZeri3Y5pwg.png" /></figure><p><strong>Solution<br> </strong>Create a simple and informative dashboard about the company sales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/0*lirCtxYGn2YGtRJ4" /></figure><p>I used <strong>SQL</strong> queries in <strong>MySQL Workbench</strong> to take a look into the data and <strong>Power BI</strong> for <em>ETL</em> and visualizations to create the insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_yTRYjAm_KeYfCtXKb1cw.png" /></figure><p><strong>Overview</strong></p><ul><li>After a quick data exploration in MySQL, here are some initial findings:</li><li>The database contains 5 tables: <strong>customers, date, markets, products, and transactions;</strong></li><li>There are <strong>17 markets, 279 products, and 38 customers</strong>;</li><li>The observation period is from <strong>January 2018 to June 2020;</strong></li><li>Most of the transactions data are in<strong> INR currency</strong>, but we have 2 records in <strong>U$ currency</strong>.</li><li>And we got Paris and New York on the <strong>“sales markets”</strong> table. We’re going to deal with it in the ETL process.</li></ul><p><strong>ETL (Extract, Transform, Load)</strong></p><p>Once I know the basic features of the data I have to work with, I imported the MySQL database into Power BI to do the necessary transformations and end up with a simple, reliable, and useful dashboard</p><p><strong>Data Modeling Step</strong><br> We got five tables and we need to ensure that the tables are correctly connected.</p><p><strong>TABLES CONNECTED<br> [sales transactions] </strong>— main table<strong><br> </strong>— sales customers &gt; connected by <strong>“customer code”</strong> column;<strong><br> </strong>— sales date&gt; connected by <strong>“date” </strong>column;<strong><br> </strong>— sales products &gt; connected by <strong>“product code”</strong> column;<strong><br> </strong>— sales markets &gt; connected by <strong>“market code”</strong> column.</p><p><strong>Measures Created</strong><em><br> </em><strong>“Revenue”</strong> and <strong>“Sales Qty” </strong>measures to get the sum of each column instantly in the dashboard.</p><p><strong>Filtering</strong><em><br> </em>Once the company is operating only in India, Infiltered out “Paris” and “New York” in the <strong>sales markets </strong>table by unchecking the “(blank)” field in the “zone” column.</p><p><strong>Cleaning and adding new column<br>-</strong>The <strong>“sales amount”</strong> column has <strong>-1</strong> and <strong>0</strong> values. I removed them in this case so we can see only the actual sales numbers on the dashboard (sometimes “0” means promotional sales and giveaways, but to know that, we should have further information, which is not the case of this project).</p><ul><li>I find out that the <strong>“currency”</strong> column (sales transactions table) have <strong>2 USD currency values</strong>, 2 of them with hidden characters, so i had to include an argument into the conditional formula, in order to create a new column called “Actual_sales”, where it converts the <strong>USD currency value</strong> into <strong>INR currency value</strong>.</li></ul><p>After all the analysis and transformation, my data is reliable enough to build the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OM2z88BxYsFtF_r2yYBGJA.png" /></figure><p><strong>Summary</strong></p><p>The dashboard shows all the main information about the company sales, such as <strong>Revenue, Sales Quantity, Revenue and Sales by Market, Revenue Trend, Top5 Customers and Top 5 Products.<br> </strong>It can be filtered by YEAR and MONTH inside the observation period, so the sales director can have a deeper and quick view of the sales to support his decision making process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16341ce1f849" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuation of Basics of Python]]></title>
            <link>https://medium.com/@sharmitharam2000/continuation-of-basics-of-python-e2d8adcc23c7?source=rss-e646a2433ab2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2d8adcc23c7</guid>
            <dc:creator><![CDATA[SHARMITHA AR]]></dc:creator>
            <pubDate>Sun, 28 Jan 2024 08:16:10 GMT</pubDate>
            <atom:updated>2024-01-28T08:16:10.036Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Operator?</h3><p>Ans: An operator is used to perform operations between two values or variables</p><h3>Different type of Operators in Python</h3><ol><li>Arithmetic Operator</li><li>Assignment Operator</li><li>Comparison Operator (Relational Operator)</li><li>Logical Operator</li><li>Membership Operator</li><li>Identity Operator</li><li>Bitwise Operator</li></ol><h3>Arithmetic Operator: Arithmetic operators are used to perform arithmetic operations between variables</h3><ol><li>Addition (+)</li><li>Subtraction (-)</li><li>Multiplication (*)</li><li>Division (/)</li><li>Modulus (%)</li><li>Exponentiation (**)</li><li>Floor Division(//)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*yLm6-52x9ZnnzPgJeKscHA.png" /></figure><h3><strong>Comparison Operators [Relationship Operator]</strong></h3><p>Comparison Operators are used to compare two values and Output of Comparison operator is always an Boolean value</p><h3>Type of Comparison Operators</h3><ol><li>Equal-to (==)</li><li>Not Equal-to (!=)</li><li>Greater Than (&gt;)</li><li>Less Than (&lt;)</li><li>Greater Than or Equal-to (&gt;=)</li><li>Less Than or Equal-to (&lt;=)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*XbwvoIpj3ONHTqDR14hhWQ.png" /></figure><h3>Logical Operators</h3><p>Logical Operators are used to combine conditional statements Will first understand what is conditional statements before going to logical operators.<br>Type of Conditional Statement in Python: Basically we have 3 Conditional Statements in Python</p><ol><li>if</li><li>elif</li><li>else</li></ol><p>if True:<br> print(‘we are doing great’)<br>else:<br> print(‘worst’)</p><pre>we are doing great</pre><p>x = 20<br>y = 25</p><p><em># Conditional Statement</em><br>if x == y: <br> print(‘Equal’)<br>elif x &gt; y:<br> print(‘Greater’)<br>else:<br> print(‘Smaller’)</p><pre>Smaller</pre><h3>Type of Logical Operators:</h3><ol><li>and (Logical and)</li><li>or (Logical or)</li><li>not (Logical not)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*MQrt5lOwb4wM-yt9NTMHEw.png" /></figure><h3>Identity Operators</h3><p>Identity operators are used to compare objects</p><ol><li>is → returns True if both variables are same object</li><li>is not — -&gt; returns Trueif both variables are not same object</li></ol><p>list1 = [10,20,30]<br>list2 = [10,20,30]<br>list3 = list1<br><em># Is operator # It prints True because it is storing in same memory location<br></em>list3 is list1</p><pre>True</pre><p><em># Now will check for memory location </em><br>print(‘Memory Location for list1 =’,id(list1))<br>print(‘Memory Location for list2 =’,id(list2))<br>print(‘Memory Location for list3 =’,id(list3))</p><p>if id(list1) == id(list2):<br> print(‘List1 mand list2 store in same memory location’)<br>elif id(list2) == id(list3):<br> print(‘List2 and list3 store in same memory location’)<br>elif id(list1) == id(list3):<br> print(‘List1 and list3 store in same memory location’)</p><pre>Memory Location for list1 = 1728733038016<br>Memory Location for list2 = 1728733030912<br>Memory Location for list3 = 1728733038016<br>List1 and list3 store in same memory location</pre><h3>Membership Operators</h3><p>Membership Operators are used to check if the certain value is present in a list</p><ol><li>in</li><li>not in</li></ol><p>list1 = [2,4,23,5]<br>a=19<br>a in list1 <em># it will check if 19 is present in list1 or not if it is not present it return False else it prints True</em></p><pre>False</pre><h3>Bitwise Operators</h3><p>Bitwise operators are used to compare binary numbers</p><p>Type of Bitwise Operators</p><ol><li>Bitwise AND (&amp;) — Sets each bit to 1 if both bits are 1</li><li>Bitwise OR (|) — Sets each bit to 1 if one of the bits is 1</li><li>Bitwise XOR (^) — Sets each bit to 1 if only one of the bits is 1</li><li>Bitwise NOT (~) — Inverts all bits</li><li>Left Shift (&lt;&lt;) — Shift left by pushing in zeros from the right and let the leftmost bits fell off</li><li>Right Shift (&gt;&gt;) — shift right by pushing copies of the leftmost bit by adding zero</li></ol><p># Example for bit wise and(&amp;) operator<br>print(bin(10))<br>print(bin(12))</p><pre>0b1010<br>0b1100</pre><h3>What is Functions</h3><p>A function is a block of code which only runs when it is called.</p><h3>Why do we use function</h3><p>We use function to Re-usability of code, and Minimizes redundancy (repeating the same code again and again)</p><h3>Steps involved in a function</h3><ol><li>You will be defining a function</li><li>You will be calling a function</li></ol><h3>Type of function</h3><ol><li>Built in function</li><li>user defined function</li></ol><p>def greet():<br> print(‘welcome’)<br>greet()</p><pre>welcome</pre><h3>Types of Arguments in Python</h3><ol><li>Formal Arguments</li><li>Actual Arguments</li><li>Position Argument</li><li>Keyword Argument</li><li>Default Argument</li><li>Variable length Argument</li><li>Keyword variable length argument</li></ol><p>Example:</p><p><em># Default Argument</em><br>def info(name, age=18):<br> print(‘Name =’,name)<br> print(‘Age =’,age)<br>info(‘Salman’)<br>info(‘Jagruti’,23)</p><pre>Name = Salman<br>Age = 18<br>Name = Jagruti<br>Age = 23</pre><h3>what is Lambda Function</h3><p>A lambda function is an anonymous function (i.e., defined without a name) that can take any number of arguments but, unlike normal functions, evaluates and returns only one expression.</p><p>example1:</p><p><em># Add 10 to argument a, and return the result:</em><br>x = lambda a : a + 10<br>print(x(5))</p><p>example2:</p><p>name=’kiran’<br>upper_case=lambda name:name<br>print(name. upper())</p><pre>KIRAN</pre><h3>Why Use Lambda Functions?</h3><p>The power of lambda is better shown when you use them as an anonymous function inside another function. Say you have a function definition that takes one argument, and that argument will be multiplied with an unknown number:</p><p>def myfunc(n):<br> return lambda a:a*n<br>mydoubler = myfunc(2)<br>mydoubler(11)</p><pre>22</pre><h3>Now will Perform Map in Lambda Function</h3><p>Map in Python is a function that works as an iterator to return a result after applying a function to every item of an iterable</p><h3>Syntax</h3><p>map(func,*iterables) -&gt; * varaiable number of elements iteration<a href="http://localhost:8888/notebooks/06.2%20Lambda%20Function.ipynb#map(func,*iterables)---%3E-*-varaiable-number-of-elements-iteration">¶</a></p><p><em># Now will square the number using lambda function </em><br>num = [2,4,6,8,10]<br>square_output = list(map(lambda x:x**2,num))<br>square_output</p><pre>[4, 16, 36, 64, 100]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2d8adcc23c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics Of PYTHON]]></title>
            <link>https://medium.com/@sharmitharam2000/basics-of-python-7e74fe1929e1?source=rss-e646a2433ab2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e74fe1929e1</guid>
            <dc:creator><![CDATA[SHARMITHA AR]]></dc:creator>
            <pubDate>Sun, 28 Jan 2024 06:37:03 GMT</pubDate>
            <atom:updated>2024-01-28T06:37:03.151Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>what is Python?</strong></p><p>It is General purpose ,High level Interpreted language with easy syntax.</p><p>Created by Guido van Rossum in 1989.</p><p><strong>Why Python is Popular?</strong></p><ul><li>It is easy syntax &amp; high level features.</li><li>Open source language ,it is free for any body to use.</li><li>Used for many applications like ,Web applications ,Artificial Intelligence , Machine Learning ,Mobile app server side etc..</li><li>Huge Libraries or Modules that can used to obtain solution.</li></ul><p><strong><em>Lets get Started.</em></strong></p><p><strong>Variables.</strong></p><p>Variables are reserved memory location that stores the data.</p><p><strong>Rules for variable names</strong></p><ul><li>Name can’t start with numbers</li><li>Name can’t contain space ,use _(under score)instead</li><li>Name can’t contain any of the special characteristic(@,$,%)</li><li>It’s a best practice that the names is always better to write in lowercase.</li><li>Avoid using Python built-in-keys.</li></ul><p>In other programming languages like C, C++, and Java, you will need to declare the type of variables but in Python you don’t need to do that. Just type in the variable and when values will be given to it, then it will automatically know whether the value given would be an int, float, or char or even a String.</p><p><strong># Python program to declare variables</strong></p><p>my Number <strong>=</strong> 4</p><p><strong>print</strong>(my Number)</p><p>my Number <strong>=</strong>&quot;hello world&quot;</p><p>print(my Number)</p><pre>4<br>helloworld</pre><p>See, how simple is it, just create a variable and assign it any value you want and then use the print function to print it.</p><h4>You can connect a different value with a previously assigned variable very easily through simple reassignment.</h4><p>Example 1:</p><p>Data Scientist = Trainer = Programmer = “Ganesh”<br>print(‘Data Scientist =’,Data Scientist)<br>print(‘Trainer =’,Trainer)<br>print(‘Programmer =’,Programmer)</p><pre>DataScientist = Ganesh<br>Trainer = Ganesh<br>Programmer = Ganesh</pre><p>Example 2:</p><p>Name, Age, Gender = ‘Ganesh’,45,’Male’<br>print(‘Name =’,Name)<br>print(‘Age =’,Age)<br>print(‘Gender =’,Gender)</p><pre>Name = Ganesh<br>Age = 45<br>Gender = Male</pre><p><strong>Python Data Types.</strong></p><p>Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, data types are classes and variables are instances (objects) of these classes. The following are the built-in data types in Python.</p><p><strong>How type() Function Works in Python?</strong></p><p>In the given example, we are printing the type of variable x. We will determine the type of an object in Python.</p><p>Python</p><p>x <strong>=</strong> 10</p><p>print(type(x))</p><p><strong>Output</strong></p><pre>&lt;class &#39;int&#39;&gt;</pre><p><strong>Data Types in Python.</strong></p><ol><li><strong>String</strong></li></ol><p>str: String type for storing text (e.g., &quot;Hello, World!&quot;).</p><p><em>list </em><strong>-</strong>We create a list by placing elements inside [], separated by comma(e.g.,{112, 114, 116, 118, 115})<br>2. <strong>Numeric </strong><br> 1. <em>Integer</em>- int: Integer type (e.g., 5, -10).<br> 2. <em>Float-</em> float: Floating-point type (e.g., 3.14, -2.7).<br>3. <strong>Boolean</strong>-bool: Represents truth values, either True or False.<br>4.<strong> None </strong><br>5. <strong>Collection</strong><br> 1. <em>List</em>-<br> 2. <em>Tuple- </em>my tuple = (1, 2, 3, “hello”)<br> 3. <em>Dictionary</em>-dict: Collection of key-value pairs (e.g., {&quot;name&quot;: &quot;John&quot;, &quot;age&quot;: 25}).<br> 4. <em>Set</em>-set: Unordered collection of unique elements (e.g., {1, 2,3}).</p><h3>Creating a String</h3><p>To create a string in Python you need to use either single quotes or double quotes.</p><p>For example:</p><p><em># Single quotes<br></em>‘hello’</p><pre>&#39;hello&#39;</pre><p><em># Double quotes</em><br>“String built with double quotes”</p><pre>&#39;String built with double quotes&#39;</pre><p>We can use a print statement to print a string.</p><p>print(‘Hello World 1’)<br>print(‘Hello World 2’)<br>print(‘Use \n to print a new line’)</p><p># \n (backward slash n)is used to print in next line<br>print(‘\n’)<br>print(‘See what I mean?’)</p><h3>String Basics</h3><p>We can also use a function called len() to check the length of a string!.</p><p>Python’s built-in len() function counts all of the characters in the string, including spaces and punctuation.</p><p>Example: len(‘Hello\’ World’)</p><pre>12<br></pre><h3>String Indexing</h3><p>We know strings are a sequence, which means Python can use indexes to call parts of the sequence. Let’s learn how this works.</p><p>In Python, we use brackets [] after an object to call its index. We should also note that indexing starts at 0 for Python. Let&#39;s create a new object called s and then walk through a few examples of indexing.</p><p><em># Assign s as a string</em><br>s = ‘Hello World’</p><p><em># Print the object</em><br>print(s)</p><pre>Hello World</pre><p>Let’s start indexing!</p><p><em># Show first element (in this case a letter)</em><br>s[0]</p><pre>&#39;H&#39;</pre><p>s[2]</p><pre>&#39;l&#39;</pre><p>We can use a : colon to perform <em>slicing</em> which grabs everything up to a designated point.</p><p>For example: s[1:]</p><pre>&#39;ello World&#39;</pre><p><em># Note Indexing does not affects the original data</em><br>s</p><pre>&#39;Hello World&#39;</pre><p><strong>We can also use negative indexing to go backwards.</strong></p><p><em># Last letter (one index behind 0 so it loops back around)</em><br>s[-1]</p><pre>&#39;d&#39;</pre><h3>String Properties</h3><p>It’s important to note that strings have an important property known as <em>immutability</em>. This means that once a string is created, the elements within it can not be changed or replaced.</p><p>For example: s</p><pre>&#39;Hello World&#39;</pre><p><em># Concatenate strings!</em><br>s + ‘ I love my India!’</p><pre>&#39;Hello WorldI love my India!&#39;</pre><h3>string function</h3><p>Name=’India’<br>print(Name)</p><pre>India</pre><p><em># Replace String<br># The replace() method replaces a string with another string</em></p><p>Name = ‘Varun’<br>print(Name. Replace(‘v’, ’t’))</p><pre>tarun</pre><h3>Booleans</h3><p>Python comes with Booleans (with predefined True and False displays that are basically just the integers 1 and 0). It also has a placeholder object called None. Let’s walk through a few quick examples of Booleans.</p><p><em># Set object to be a boolean</em><br>a = True</p><p>type(a)</p><pre>bool</pre><h3>Lists</h3><p>Earlier when discussing strings we introduced the concept of a <em>sequence</em> in Python. Lists can be thought of the most general version of a <em>sequence</em> in Python. Unlike strings, <strong>they are mutable, meaning the elements inside a list can be changed!</strong></p><p>In this section we will learn about:</p><pre>1.) Creating lists<br>2.) Indexing and Slicing Lists<br>3.) Basic List Methods<br>4.) Nesting Lists<br>5.) etc..</pre><p>Lists are constructed with brackets [ ] and commas separating every element in the list.</p><p>Let’s go ahead and see how we can construct lists!</p><p><em># Assign a list to an variable named my_list</em><br>my_list = [1,2,3]</p><p>We just created a list of integers, but lists can actually hold different object types such as int,float, string, boolean objects, etc which makes it heterogeneous</p><p>my_list = [‘A string’,23,100.232,’o’,True]<br>my_list</p><pre>[&#39;A string&#39;, 23, 100.232, &#39;o&#39;, True]</pre><h3>Indexing and Slicing</h3><p>Indexing and slicing work just like in strings. Let’s make a new list to remind ourselves of how this works:</p><p>my_list = [‘one’,’two’,’three’,4,5,True]</p><p>type(my_list)</p><pre>list</pre><h4>Let’s go ahead and explore some more special methods for lists:</h4><p><em># Create a new list</em><br>list1 = [1,2,3]</p><p>Use the <strong>append</strong> method to permanently add an item to the end of a list:</p><p><em># Append</em><br>list1.append(‘append me!’)</p><p><em># Show</em><br>list1</p><pre>[1, 2, 3, &#39;append me!&#39;]</pre><p>Use <strong>pop</strong> to “pop off” an item from the list. By default pop takes off the last index, but you can also specify which index to pop off. Let’s see an example:</p><p>list1.pop()</p><pre>&#39;append me!&#39;</pre><h3>Nesting Lists</h3><p>A great feature of Python data structures is that they support <em>nesting</em>. This means we can have data structures within data structures. For example: A list inside a list.</p><p>Let’s see how this works!</p><p><em># Let’s make three lists</em><br>lst_1=[1,2,3]<br>lst_2=[4,5,6]<br>lst_3=[7,8,9]</p><p><em># Make a list of lists to form a matrix</em><br>matrix = [lst_1,lst_2,lst_3]</p><p><em># Show</em><br>matrix</p><pre>[[1, 2, 3], [4, 5, 6], [7, 8, 9]]</pre><p>We can again use indexing to grab elements, but now there are two levels for the index. The items in the matrix object, and then the items inside that list!</p><h3>extend</h3><p>Many times people find the difference between extend and append to be unclear. So note:</p><p><strong>append: appends whole object at end:</strong><br><strong>extend: extends list by appending elements from the iterable:</strong></p><p>x = [1, 2, 3]<br>x.append([4, 5,3])<br>print(x)</p><pre>[1, 2, 3, [4, 5, 3]]</pre><p>x = [1, 2, 3]<br>x.extend([4, 5, 3])<br>print(x)</p><pre>[1, 2, 3, 4, 5, 3]</pre><h3>index</h3><p>index() will return the index of whatever element is placed as an argument. Note: If the element is not in the list an error is raised.</p><p>list1</p><pre>[1, 2, 3, 4]</pre><p>list1.index(1)</p><pre>0</pre><h3>insert</h3><p>insert() takes in two arguments: insert(index,object) This method places the object at the index supplied. For example:</p><p>list1=[1,2,3,4]<br>list1</p><pre>[1, 2, 3, 4]</pre><p><em># Place a letter at the index 2</em><br>list1.insert(2,’inserted’)</p><p>list1</p><pre>[1, 2, &#39;inserted&#39;, 3, 4]</pre><h3>pop</h3><p>You most likely have already seen pop(), which allows us to &quot;pop&quot; off the last element of a list. However, by passing an index position you can remove and return a specific element.</p><p>element = list1.pop(1) # pop the second element</p><p>list1</p><pre>[1, &#39;inserted&#39;, 3, 4]</pre><h3>remove</h3><p>The remove() method removes the first occurrence of a value. For example:</p><p>list1</p><pre>[1, &#39;inserted&#39;, 3, 4]</pre><p>list1.remove(‘inserted’)</p><p>list1</p><pre>[1, 3, 4]</pre><h3>Delete</h3><p>del can be used to delete a single index of a list, a slice of a list, or the complete list.</p><p>list3=[1,4,6,2,6,1] # deleting perticular element in a list using index<br>del list3[1]</p><p>list3</p><pre>[1, 6, 2, 6, 1]</pre><h3>Clear</h3><p>clear will remove the element that are present in the list<br>The list still remains, but it has no content</p><p>lis = [1,2,3,4]<br>lis.clear()<br>print(lis)</p><pre>[]</pre><h3>reverse</h3><p>As you might have guessed, reverse() reverses a list. Note this occurs in place! Meaning it affects your list permanently.</p><p>list2.reverse()</p><p>list2</p><pre>[3, 4, 2, 1]</pre><h3>sort</h3><p>The sort() method will sort your list in place:</p><p>list2=[1,4,3,2]<br>list2</p><pre>[1, 4, 3, 2]</pre><h3>Tuples</h3><p>In Python tuples are very similar to lists, however, unlike lists they are <em>immutable</em> meaning they can not be changed. You would use tuples to present things that shouldn’t be changed, such as days of the week, or dates on a calendar.</p><p>In this section, we will get a brief overview of the following:</p><pre>1.) Constructing Tuples<br>2.) Basic Tuple Methods<br>3.) Immutability<br>4.) When to Use Tuples</pre><p>You’ll have an intuition of how to use tuples based on what you’ve learned about lists. We can treat them very similarly with the major distinction being that tuples are immutable.</p><h3>Constructing Tuples</h3><p>The construction of a tuples use () Parentheses with elements separated by commas. For example:</p><p>m=(‘India’,3,True)</p><p>type(m)</p><pre>tuple</pre><p>m</p><pre>(&#39;India&#39;, 3, True)</pre><p>for i in m:<br> print(i)</p><pre>India<br>3<br>True</pre><p>for index,values in enumerate(m):<br> print(index,’ — — →’,values)</p><pre>0 ------&gt; India<br>1 ------&gt; 3<br>2 ------&gt; True</pre><h3>Basic Tuple Methods</h3><p>Tuples have built-in methods, but not as many as lists do.</p><h3>Immutability</h3><p>It can’t be stressed enough that tuples are immutable. Because of this immutability, tuples can’t grow. Once a tuple is made we can not add to it.</p><h3>When to use Tuples</h3><p>You may be wondering, “Why bother using tuples when they have fewer available methods?” To be honest, tuples are not used as often as lists in programming, but are used when immutability is necessary. If in your program you are passing around an object and need to make sure it does not get changed, then a tuple becomes your solution. It provides a convenient source of data integrity.</p><p>You should now be able to create and use tuples in your programming as well as have an understanding of their immutability.</p><p>Up next Files!</p><h3>Dictionaries</h3><p>This section will serve as a brief introduction to dictionaries and consist of:</p><pre>1.) Constructing a Dictionary<br>2.) Accessing objects from a dictionary<br>3.) Nesting Dictionaries<br>4.) Basic Dictionary Methods</pre><p>A Python dictionary consists of a key and then an associated value.</p><h3>Constructing a Dictionary</h3><p>Let’s see how we can construct dictionaries to get a better understanding of how they work! Make a dictionary with {}(curly brasis) and : to signify a key and a value</p><h3>Syntax</h3><p>my_dict = {‘key1’:’value1&#39;,’key2&#39;:’value2&#39;} in dictionary always you are fetching the values from key rather than indexing</p><p>my_dict = {‘key1’:’value1&#39;,’key2&#39;:’value2&#39;}</p><p><em># Call values by their key</em><br>my_dict[‘key2’]</p><pre>&#39;value2&#39;</pre><p><strong>Its important to note that dictionaries are very flexible in the data types they can hold. For example:</strong></p><p>my_dict = {‘key1’:123,’key2&#39;:[12,23,33],’key3&#39;:[‘item0’,’item1&#39;,’item2&#39;]}</p><p><em># Let’s call items from the dictionary</em><br>my_dict[‘key3’]</p><pre>[&#39;item0&#39;, &#39;item1&#39;, &#39;item2&#39;]</pre><p><strong>We can affect the values of a key as well. For instance:</strong></p><p>my_dict[‘key1’]</p><pre>123</pre><p>We can also create keys by assignment. For instance if we started off with an empty dictionary, we could continually add to it:</p><p><em># Create a new dictionary</em><br>d = {}</p><p>type(d)</p><pre>dict</pre><p><em># Create a new key through assignment</em><br>d[‘animal’] = ‘Dog’<br>d</p><pre>{&#39;animal&#39;: &#39;Dog&#39;}</pre><h3>Nesting with Dictionaries</h3><p>Hopefully you’re starting to see how powerful Python is with its flexibility of nesting objects and calling methods on them. Let’s see a dictionary nested inside a dictionary:</p><p><em># Dictionary nested inside a dictionary nested inside a dictionary</em><br>d = {‘key1’:{‘nestkey’:{‘subnestkey’:’value’},’nestkey2&#39;:[1,2,3]}}<br>d[‘key1’][‘nestkey2’][1]</p><pre>2</pre><h3>A few Dictionary Methods</h3><p>There are a few methods we can call on a dictionary. Let’s get a quick introduction to a few of them:</p><p><em># Create a typical dictionary</em><br>d = {‘key1’:[1,23,56],’key2&#39;:2,’key3&#39;:3}</p><p><em># Method to return a list of all keys </em><br>d.keys()</p><pre>dict_keys([&#39;key1&#39;, &#39;key2&#39;, &#39;key3&#39;])</pre><p><em># Method to grab all values</em><br>d.values()</p><pre>dict_values([[1, 23, 56], 2, 3])</pre><h3>Sets</h3><p>Sets are an unordered collection of <em>unique</em> elements. We can construct them by using the set() function. Let’s go ahead and make a set to see how it works</p><p><em># Declaire the set</em><br>x = set()<br><em># We add to sets with the add() method</em><br>x.add(1)<br><em>#Show</em><br>x</p><pre>{1}</pre><p>Note the curly brackets. This does not indicate a dictionary! Although you can draw analogies as a set being a dictionary with only keys.</p><p>We know that a set has only unique entries. So what happens when we try to add something that is already in a set?</p><p><em># Add a different element</em><br>x.add(2)<br><em>#Show</em><br>x</p><pre>{1, 2}</pre><p>Notice how it won’t place another 1 there. That’s because a set is only concerned with unique elements! We can cast a list with multiple repeat elements to a set to get the unique elements. For example:</p><p><em># Create a list with repeats</em><br>list1 = [1,1,2,2,3,4,5,6,1,1]<br>print(list1)</p><pre>[1, 1, 2, 2, 3, 4, 5, 6, 1, 1]</pre><h3>copy</h3><p>returns a copy of the set. Note it is a copy, so changes to the original don’t effect the copy.<br>Will Learn More about copy (There are 3 types of copy)</p><ol><li>‘Normal copy’</li><li>‘Shallow copy’</li><li>‘Deep copy’</li></ol><p>s = {1,2,3}<br>sc = s.copy()<br>sc</p><pre>{1, 2, 3}</pre><h3>difference</h3><p>difference returns the difference of two or more sets. The syntax is:</p><pre>set1.difference(set2)</pre><p>For example:</p><p><em># Difference</em><br>set1 = {2,4,5,6}<br>set2 = {5,6,7,8}<br>set1.difference(set2) # It print only those data which are present in set1 and that are not present in set2</p><pre>{2, 4}</pre><h3>difference_update</h3><p>difference_update syntax is:</p><pre>set1.difference_update(set2)</pre><p>the method returns set1 after removing elements found in set2</p><p>s1 = {1,2,3}</p><p>s2 = {1,4,5}</p><p>s1.difference_update(s2)</p><p>s1</p><pre>{2, 3}</pre><h3>discard</h3><p>Removes an element from a set if it is a member. If the element is not a member, do nothing.</p><p>s</p><pre>{1, 2, 3, 4}</pre><p>s.discard(2)<br>s</p><pre>{1, 3}</pre><h3>intersection and intersection_update</h3><p>Returns the intersection of two or more sets as a new set.(i.e. elements that are common to all of the sets.)</p><h3>Union</h3><p>union will print you the unique records from both the variable</p><p>print(s1,s2)<br>s1.union(s2)<br>s1.add(3)<br>print(‘s1 =’,s1)<br>print(‘s2 =’,s2)</p><pre>{1, 2, 3} {1, 2, 4}<br>s1 = {1, 2, 3}<br>s2 = {1, 2, 4}</pre><h3>symmetric_difference</h3><p>symmetric difference will print non common records from both the variables.</p><p>print(‘s1=’,s1)<br>print(‘s2=’,s2)</p><pre>s1= {1, 2, 3}<br>s2= {1, 2, 4}</pre><p>s1.symmetric_difference(s2)</p><pre>{3, 4}</pre><h3>isdisjoint</h3><p>This method will return True if two sets have a null intersection.</p><p>s1 = {1,2}<br>s2 = {1,2,4}<br>s3 = {5}<br>s1.isdisjoint(s2)</p><pre>False</pre><p>s1 = {1,2}<br>s2 = {1,2}<br>s1.issubset(s2)</p><pre>True</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e74fe1929e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>