<?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 Shanmugapriya on Medium]]></title>
        <description><![CDATA[Stories by Shanmugapriya on Medium]]></description>
        <link>https://medium.com/@shanmu1601?source=rss-c9695e64eed5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Shanmugapriya on Medium</title>
            <link>https://medium.com/@shanmu1601?source=rss-c9695e64eed5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:38:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shanmu1601/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[Typescript]]></title>
            <link>https://medium.com/@shanmu1601/typescript-eaf20c802ee9?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaf20c802ee9</guid>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Tue, 28 Jun 2022 09:18:32 GMT</pubDate>
            <atom:updated>2022-06-28T09:18:32.164Z</atom:updated>
            <content:encoded><![CDATA[<p>TypeScript adds additional syntax to JavaScript to support a <strong>tighter integration with your editor</strong>. It is used to find errors at the earlier stage in the editor. The typescript code gets converted into JavaScript code, so that it runs where ever JavaScript runs. Without involving any additional tools, it gives you type inference as a great tool to work with. It allows developers to add types to JavaScript.</p><p>JavaScript is a loosely typed language. It can be difficult to understand what types of data are being passed around in JavaScript. In JavaScript, function parameters and variables don’t have any information! So developers need to look at documentation, or guess based on the implementation. TypeScript allows specifying the types of data being passed around within the code, and has the ability to report errors when the types don’t match. For example, TypeScript will report an error when passing a string into a function that expects a number. JavaScript will not.</p><p>The TypeScript compiler can be configured using:</p><pre>tsconfig.jason</pre><p>Creating a variable in typescript involves two types. They are:</p><pre>1.Explicit<br>2.Implicit</pre><ol><li><strong>Explicit</strong></li></ol><p>It involves writing out the type. This type assignment are easier to read and more intentional.</p><p>EXAMPLE</p><pre>let firstName: string = &quot;Zodiac&quot;;</pre><p><strong>2. Implicit</strong></p><p>The type will be guessed by the TypeScript based on the assigned value. This type is easier to type and is used for testing.</p><pre>let firstName = &quot;Zodiac&quot;;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaf20c802ee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices]]></title>
            <link>https://medium.com/@shanmu1601/microservices-e27265d2319d?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e27265d2319d</guid>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Mon, 13 Jun 2022 05:54:19 GMT</pubDate>
            <atom:updated>2022-06-13T05:54:19.230Z</atom:updated>
            <content:encoded><![CDATA[<p>When we create an app, not a small one but a but complex one, the important problem that we face search for some particular code in that giant app code. It will be difficult to parse through the code to find what we need. So in order make the coding look simple, microservices are used. We break our app into microservices which are executed independently and communicate with each other</p><p>Imagine you are creating an app for online bookstore. How will you split your app into mocroservices? So, here are some ways you could break up your hypothetical online bookstore into microservices:</p><blockquote>Marketplace serves- the logic for the user to navigate around the site.</blockquote><blockquote>Cart -keeps track of what the user has put in their cart and the checkout flow.</blockquote><blockquote>Transactions handles payment processing and sending receipts.</blockquote><blockquote>Inventory — provides data about which books are in stock.</blockquote><blockquote>User Account- manages user signup and account details, such as changing their password.</blockquote><blockquote>Reviews -stores book ratings and reviews entered by users.</blockquote><p>Some of the advantages of microservices are provided below for your understanding.</p><blockquote>There’s ability to change the implementation of a public API, without breaking it, the moment you define it and others start using it</blockquote><blockquote>The services are so small that they make maintenance from one developer to another easier to facilitate and understand.</blockquote><blockquote>There are no development language limitations, so you can use what’s best for you and your team.</blockquote><blockquote>It is easier to upgrade systems one microservice at a time than it is to upgrade a monolithic system.</blockquote><blockquote>Cross-implementation compatibility allows you to prototype in one language and re-implement in another.</blockquote><blockquote>Regardless of the size of your operation, if most of your product builds require more detailed components and adaptive development, then microservices are a better approach.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e27265d2319d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular JS]]></title>
            <link>https://medium.com/@shanmu1601/angular-js-aeabe1bd8b1e?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeabe1bd8b1e</guid>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 12:27:14 GMT</pubDate>
            <atom:updated>2022-06-10T12:27:14.123Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular JS is a Google-created open-source JavaScript framework. All of the interactive components that we commonly see on a website may be created with AngularJS. The framework’s primary goal is to aid in the development of single-page applications. Web developers favour AngularJS over other frameworks because it prioritises code quality and testability.</p><p><strong>EXAMPLES</strong></p><p>Paypal, Udemy, Snapchat, Amazon, Netflix, and Gmail are just a few of the major websites and services that employ AngularJS.</p><p><strong>ADVANTAGES</strong></p><p>1.Easy to learn</p><p>2.It has a two way binding nature</p><p>3.Supports SPA features</p><p>4.Has a declarative UI</p><p>5.Supported by google</p><p>6.Real time testing</p><p>7.It is a powerful framework</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeabe1bd8b1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Synchronization in multithreading]]></title>
            <link>https://medium.com/@shanmu1601/synchronization-in-multithreading-f380af626548?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f380af626548</guid>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 12:05:02 GMT</pubDate>
            <atom:updated>2022-06-10T12:05:02.644Z</atom:updated>
            <content:encoded><![CDATA[<p>When two or more threads run concurrently, there is a chance of inconsistency in the threading. This can be solved by synchronization which makes sure that two or more concurrent threads execute the same part of the program. This is called critical section, where the shared resource is accessed.</p><p>The tools that can be used to solve this inconsistency issues are:</p><p><strong>LOCKS</strong></p><p>Lock class provides following methods:</p><ul><li><strong>acquire([blocking]) :</strong> To acquire a lock. A lock can be blocking or non-blocking.</li><li>When invoked with the blocking argument set to <strong>True</strong> (the default), thread execution is blocked until the lock is unlocked, then lock is set to locked and return <strong>True</strong>.</li><li>When invoked with the blocking argument set to <strong>False</strong>, thread execution is not blocked. If lock is unlocked, then set it to locked and return <strong>True</strong> else return <strong>False</strong> immediately.</li><li><strong>release() :</strong> To release a lock.</li><li>When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed.</li><li>If lock is already unlocked, a <strong>ThreadError</strong> is raised.</li></ul><p><strong>Lock</strong> class provides following methods:</p><ul><li><strong>acquire([blocking]) :</strong> To acquire a lock. A lock can be blocking or non-blocking.</li><li>When invoked with the blocking argument set to <strong>True</strong> (the default), thread execution is blocked until the lock is unlocked, then lock is set to locked and return <strong>True</strong>.</li><li>When invoked with the blocking argument set to <strong>False</strong>, thread execution is not blocked. If lock is unlocked, then set it to locked and return <strong>True</strong> else return <strong>False</strong> immediately.</li><li><strong>release() :</strong> To release a lock.</li><li>When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed.</li><li>If lock is already unlocked, a <strong>ThreadError</strong> is raised.</li></ul><p><strong>Lock</strong> class provides following methods:</p><ul><li><strong>acquire([blocking]) :</strong> To acquire a lock. A lock can be blocking or non-blocking.</li><li>When invoked with the blocking argument set to <strong>True</strong> (the default), thread execution is blocked until the lock is unlocked, then lock is set to locked and return <strong>True</strong>.</li><li>When invoked with the blocking argument set to <strong>False</strong>, thread execution is not blocked. If lock is unlocked, then set it to locked and return <strong>True</strong> else return <strong>False</strong> immediately.</li><li><strong>release() :</strong> To release a lock.</li><li>When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed.</li><li>If lock is already unlocked, a <strong>ThreadError</strong> is raised.</li></ul><p><strong>Lock</strong> class provides following methods:</p><ul><li><strong>acquire([blocking]) :</strong> To acquire a lock. A lock can be blocking or non-blocking.</li><li>When invoked with the blocking argument set to <strong>True</strong> (the default), thread execution is blocked until the lock is unlocked, then lock is set to locked and return <strong>True</strong>.</li><li>When invoked with the blocking argument set to <strong>False</strong>, thread execution is not blocked. If lock is unlocked, then set it to locked and return <strong>True</strong> else return <strong>False</strong> immediately.</li><li><strong>release() :</strong> To release a lock.</li><li>When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed.</li><li>If lock is already unlocked, a <strong>ThreadError</strong> is raised.</li></ul><pre><strong>import</strong> threading</pre><pre>x <strong>=</strong> 0</pre><pre><strong>def</strong> increment():</pre><pre><strong>global</strong> x</pre><pre>x <strong>+=</strong> 1</pre><pre><strong>def</strong> thread_task(lock):</pre><pre><strong>for</strong> _ <strong>in</strong> range(100000):</pre><pre>lock.acquire()</pre><pre>increment()</pre><pre>lock.release()</pre><pre><strong>def</strong> main_task():</pre><pre><strong>global</strong> x</pre><pre>x <strong>=</strong> 0</pre><pre># creating a lock</pre><pre>lock <strong>=</strong> threading.Lock()</pre><pre># creating threads</pre><pre>t1 <strong>=</strong> threading.Thread(target<strong>=</strong>thread_task, args<strong>=</strong>(lock,))</pre><pre>t2 <strong>=</strong> threading.Thread(target<strong>=</strong>thread_task, args<strong>=</strong>(lock,))</pre><pre># start threads</pre><pre>t1.start()</pre><pre>t2.start()</pre><pre># wait until threads finish their job</pre><pre>t1.join()</pre><pre>t2.join()</pre><pre><strong>if</strong> __name__ <strong>==</strong> &quot;__main__&quot;:</pre><pre><strong>for</strong> i <strong>in</strong> range(10):</pre><pre>main_task()</pre><pre>print(&quot;Iteration {0}: x = {1}&quot;.format(i,x))</pre><p>Output:</p><pre>Iteration 0: x = 200000<br>Iteration 1: x = 200000<br>Iteration 2: x = 200000<br>Iteration 3: x = 200000<br>Iteration 4: x = 200000<br>Iteration 5: x = 200000<br>Iteration 6: x = 200000<br>Iteration 7: x = 200000<br>Iteration 8: x = 200000<br>Iteration 9: x = 200000</pre><p><strong>Advantages:</strong></p><ul><li>It doesn’t block the user. This is because threads are independent of each other.</li><li>Better use of system resources is possible since threads execute tasks parallely.</li><li>Enhanced performance on multi-processor machines.</li><li>Multi-threaded servers and interactive GUIs use multithreading exclusively.</li></ul><p><strong>Disadvantages:</strong></p><ul><li>As number of threads increase, complexity increases.</li><li>Synchronization of shared resources (objects, data) is necessary.</li><li>It is difficult to debug, result is sometimes unpredictable.</li><li>Potential deadlocks which leads to starvation, i.e. some threads may not be served with a bad design</li><li>Constructing and synchronizing threads is CPU/memory intensive.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f380af626548" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Collections]]></title>
            <link>https://medium.com/@shanmu1601/collections-729231bb22cd?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/729231bb22cd</guid>
            <category><![CDATA[dictionary]]></category>
            <category><![CDATA[tuples]]></category>
            <category><![CDATA[collection]]></category>
            <category><![CDATA[lists]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Tue, 24 May 2022 15:55:45 GMT</pubDate>
            <atom:updated>2022-05-24T15:56:40.043Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Storing data and Iterating through objects</em></p><p>Collection is a module in python which stores objects and iterate over them. It is used as a container to store collection of data. The collection module provides various container in order to store the data. Some of the in built containers are list, tuple and dictionary. There are other containers which will be discussed shortly in this blog .</p><h3><strong>Counter</strong></h3><p>Counter is an unordered collection which is a sub-class of the dictionary. The elements are stored as dict keys and the count as dict value.</p><p><strong>Syntax</strong></p><pre>class collections.Counter([iterable-or-mapping])</pre><p><strong>Example</strong></p><pre>from collections import Counter</pre><pre>print(Counter([‘B’,’B’,’A’,’B’,’C’,’A’,’B’,’B’,’A’,’C’]))</pre><pre>print(Counter({‘A’:3, ‘B’:5, ‘C’:2}))</pre><pre>print(Counter(A=3, B=5, C=2))</pre><p><strong>Output</strong></p><pre>Counter({&#39;B&#39;: 5, &#39;A&#39;: 3, &#39;C&#39;: 2})<br>Counter({&#39;B&#39;: 5, &#39;A&#39;: 3, &#39;C&#39;: 2})<br>Counter({&#39;B&#39;: 5, &#39;A&#39;: 3, &#39;C&#39;: 2})</pre><h3><strong>DefaultDict</strong></h3><p>DefaultDict dictionary is a subclass used for constructing default values for missing keys and automatically adding them to the dictionary.</p><p><strong>Syntax</strong></p><pre>class collections.defaultdict(default_factory)</pre><p><strong>Example</strong></p><pre><strong>from</strong> collections <strong>import</strong> defaultdict</pre><pre>d <strong>=</strong> defaultdict(int)</pre><pre>L <strong>=</strong> [1, 2, 3, 4, 2, 4, 1, 2]</pre><pre><strong>for</strong> i <strong>in</strong> L:</pre><pre>d[i] <strong>+=</strong> 1</pre><pre>print(d)</pre><p><strong>Output</strong></p><pre>defaultdict(&lt;class &#39;int&#39;&gt;, {1: 2, 2: 3, 3: 1, 4: 2})</pre><h3><strong>OrderedDict</strong></h3><p>This sub class of the dictionary remembers the order of the keys in which they were first inserted.</p><p><strong>Syntax</strong></p><pre>class collections.OrderDict()</pre><p><strong>Example</strong></p><pre>import collections<br><br>d1 = collections.OrderedDict()<br>d1[&#39;A&#39;] = 65<br>d1[&#39;C&#39;] = 67<br>d1[&#39;B&#39;] = 66<br>d1[&#39;D&#39;] = 68<br><br>for k,v in d1.items():<br>    print (k,v)</pre><p><strong>UserDict</strong></p><p>A wrapper class around a dictionary object that facilitates subclassing dict.</p><p><strong>UserList</strong></p><p>A wrapper class around a list object that facilitates subclassing list.</p><p><strong>UserString</strong></p><p>A wrapper class around a string object that facilitates subclassing string.</p><h3><strong>Deque</strong></h3><p>Deque(Doubly Ended Queue) is a sequence-like collection that supports efficient addition and removal of items from either end of the sequence.</p><p><strong>Syntax</strong></p><pre>class collections.deque(list)</pre><p><strong>Example</strong></p><pre><strong>from</strong> collections <strong>import</strong> deque</pre><pre>queue <strong>=</strong> deque([&#39;name&#39;,&#39;age&#39;,&#39;DOB&#39;])</pre><pre>print(queue)</pre><p><strong>Output</strong></p><pre>deque([&#39;name&#39;, &#39;age&#39;, &#39;DOB&#39;])</pre><h3>NamedTuple</h3><p>NamedTuple is a factory function for creating subclasses of tuple that provides named fields that allow accessing items by name while keeping the ability to access items by index</p><p><strong>Syntax</strong></p><pre>class collections.namedtuple(typename, field_names)</pre><p><strong>Example</strong></p><pre><strong>from</strong> collections <strong>import</strong> namedtuple</pre><pre>Student <strong>=</strong> namedtuple(&#39;Student&#39;,[&#39;name&#39;,&#39;age&#39;,&#39;DOB&#39;])</pre><pre>S <strong>=</strong> Student(&#39;Nandini&#39;,&#39;19&#39;,&#39;2541997&#39;)</pre><pre><strong>print</strong> (&quot;The Student age using index is : &quot;,end <strong>=</strong>&quot;&quot;)</pre><pre>print (S[1])</pre><pre><strong>print</strong> (&quot;The Student name using keyname is : &quot;,end <strong>=</strong>&quot;&quot;)</pre><pre>print (S.name)</pre><p><strong>Output</strong></p><pre>The Student age using index is : 19<br>The Student name using keyname is : Nandini</pre><h3>ChainMap</h3><p>ChainMap is a dictionary-like class that allows treating a number of mappings as a single dictionary object</p><p><strong>Syntax</strong></p><pre>class collections.ChainMap(dict1, dict2)</pre><p><strong>Example</strong></p><pre><strong>from</strong> collections <strong>import</strong> ChainMap</pre><pre>d1 <strong>=</strong> {&#39;a&#39;: 1, &#39;b&#39;: 2}</pre><pre>d2 <strong>=</strong> {&#39;c&#39;: 3, &#39;d&#39;: 4}</pre><pre>d3 <strong>=</strong> {&#39;e&#39;: 5, &#39;f&#39;: 6}</pre><pre># Defining the chainmap</pre><pre>c <strong>=</strong> ChainMap(d1, d2, d3)</pre><pre>print(c)</pre><p><strong>Output</strong></p><pre>ChainMap({&#39;a&#39;: 1, &#39;b&#39;: 2}, {&#39;c&#39;: 3, &#39;d&#39;: 4}, {&#39;e&#39;: 5, &#39;f&#39;: 6})</pre><p>Collections in python can be used to store data and can be easily traversed through the containers. Thus this module is simple and easy to use in python programming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=729231bb22cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decorators]]></title>
            <link>https://medium.com/@shanmu1601/decorators-dc8d954f16f3?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc8d954f16f3</guid>
            <category><![CDATA[decorators]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Tue, 24 May 2022 14:54:56 GMT</pubDate>
            <atom:updated>2022-05-24T14:54:56.792Z</atom:updated>
            <content:encoded><![CDATA[<p>In simple words, the decorators add functionality to an existing code. This is also called metaprogramming because a part of the program tries to modify another part of the program at compile time.Decorators are a very strong and helpful Python tool because they allow programmers to change the behaviour of a function or class. Decorators allow us to wrap another function in order to expand its behaviour without having to change it permanently. In simple words, the decorators add functionality to an existing code. This is also called metaprogramming because a part of the program tries to modify another part of the program at compile time.</p><p><strong>Properties of function</strong></p><p>1. Reference of one function to another function</p><p>2. Function can be passed as an argument</p><p>3. Function returning another function</p><p><strong>Reference of one function to another function</strong></p><pre><strong>def </strong>add(x,y): <br> print(<strong>“Addition of two numbers: “</strong>)<br> <strong>return </strong>x+y<br> print(add(5,10))<br> sum=add<br> print(sum(6,4))</pre><p><strong>Function name can be passed as argument</strong></p><pre><strong>def </strong>world():<br> print(<strong>“World”</strong>)<br> <strong>def </strong>hello(fun):<br> print(<strong>“Hello”</strong>)<br> fun()<br> hello(world)</pre><p><strong>Function returning another function</strong></p><pre><strong>def </strong>addition():<br> print(<strong>“Addition of two numbers: “</strong>)<br> <strong>def </strong>add():<br> num1=2<br> num2=4<br> print(num1+num2)<br> <strong>return </strong>add<br> sum=addition()<br> sum()</pre><p><strong>Using decorators</strong></p><p>In Decorators, functions are taken as the argument into another function and then called inside the wrapper function.</p><p>Syntax</p><pre>@decorator</pre><pre>def methodName():</pre><p><strong>Example</strong></p><pre><strong>def </strong>operation(func):<br> <strong>def </strong>inner(num):<br> print(<strong>“num”</strong>, num)<br> print(<strong>“result”</strong>)<br> func(num)<br> <strong>return </strong>inner<br> @operation<br> <strong>def </strong>square(num):<br> print(num*num)<br> square(2)<br> <br> @operation<br> <strong>def </strong>cube(num):<br> print(num*num*num)<br> cube(2)<br> <br> <strong>Output</strong></pre><pre>num 2</pre><pre>result</pre><pre>4</pre><pre>num 2</pre><pre>result</pre><pre>8</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc8d954f16f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exception Handling]]></title>
            <link>https://medium.com/@shanmu1601/exception-handling-6b67f632a29e?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b67f632a29e</guid>
            <category><![CDATA[exception-handling]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Sun, 22 May 2022 06:52:37 GMT</pubDate>
            <atom:updated>2022-05-24T16:08:24.730Z</atom:updated>
            <content:encoded><![CDATA[<p>Exceptions are raised when the syntax of the program is right , yet the code brought about a error. This mistake doesn’t stop the execution of the program, nonetheless, it changes the ordinary progression of the program. Python has many implicit exceptions that are raised when your program experiences a error (something in the program turns out wrong).</p><p>At the point when these exemptions happen, the Python interpreter stops the ongoing system and passes it to the calling system until it is dealt with. On the off chance that not dealt with, the program will crash.</p><p><strong>EXAMPLE</strong></p><pre>marks = 99</pre><pre>a = marks / 0</pre><pre>print(a)</pre><p><strong>OUTPUT</strong></p><pre>ZeroDivision Error</pre><p><strong>EXCEPTION HANDLING</strong></p><p>When an error occurs, or exception as we call it, Python will normally stop and generate an error message. These exceptions can be handled using the try statement</p><p><strong>SYNTAX</strong></p><pre>try:</pre><pre>#statement</pre><pre>except:</pre><pre>#statement</pre><p><strong>EXAMPLE</strong></p><pre>try:<br> print(e)<br> except:<br> print(“An exception occurred”)</pre><p><strong>Else</strong></p><p>You can use the else keyword to define a block of code to be executed if no errors were raised:</p><p><strong>SYNTAX</strong></p><pre>else:</pre><pre>#statement</pre><p><strong>EXAMPLE</strong></p><pre>try:<br> print(“Hello”)<br> except:<br> print(“Exception is found”)<br> else:<br> print(“No Exception”)</pre><h3>Finally</h3><p>The finally block, if specified, will be executed regardless if the try block raises an error or not.</p><p><strong>SYNTAX</strong></p><pre>finally:</pre><pre>#statement</pre><p><strong>EXAMPLE</strong></p><pre>try:<br> print(x)<br> except:<br> print(“Exception is found”)<br> finally:<br> print(“The ‘try except’ is finished”)</pre><p><strong>USER DEFINED EXCEPTION</strong></p><p>As a Python developer you can choose to throw an exception if a condition occurs.To throw (or raise) an exception, use the raise keyword.</p><p><strong>SYNTAX</strong></p><pre>raise TypeOfException()</pre><p><strong>EXAMPLE</strong></p><pre>x = “hello”<br> <br> if not type(x) is int:<br> raise TypeError(“Only integers are allowed”)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b67f632a29e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polymorphism]]></title>
            <link>https://medium.com/@shanmu1601/polymorphism-1df8ad180a9?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1df8ad180a9</guid>
            <category><![CDATA[polymorphism]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Sun, 22 May 2022 06:04:34 GMT</pubDate>
            <atom:updated>2022-05-24T16:06:27.671Z</atom:updated>
            <content:encoded><![CDATA[<p>The word polymorphism implies having many structures. In programming, polymorphism implies a similar capacity name (yet various marks) being utilized for various sorts</p><p><strong>EXAMPLE</strong></p><p><strong># In-built polymorphic function</strong></p><pre>print(len(“Hello”))</pre><pre>print(len([1, 2, 3, 4]))</pre><p><strong>OUTPUT</strong></p><pre>5</pre><pre>3</pre><p><strong># User defined polymorphic function</strong></p><pre>def add(a, b, c = 0):</pre><pre>return a + b + c</pre><pre>print(add(1, 2))</pre><pre>print(add(1, 2, 3))</pre><p><strong>OUTPUT</strong></p><pre>3</pre><pre>6</pre><p><strong>POLYMORPHISM AND CLASS METHODS</strong></p><p>The below code demonstrates the way that Python can utilize two different class types, similarly. We make a for circle that emphasizes through a tuple of articles. Then call the techniques without being worried about which class type each item is. We expect that these techniques really exist in each class.</p><p><strong>POLYMORPHISM AND INHERITANCE</strong></p><p>Like in other programming languages, the child classes in Python likewise acquire techniques and characteristics from the parent class. We can reclassify specific strategies and traits explicitly to fit the child class, which is known as Method Overriding. Polymorphism permits us to get to these overridden methods and properties that have a similar name as the parent class.</p><p><strong>EXAMPLE</strong></p><pre>class Bird:</pre><pre>def intro(self):</pre><pre>print(“There are different types of birds”)</pre><pre>def flight(self):</pre><pre>print(“Most of the birds can fly but some cannot”)</pre><pre>class parrot(Bird):</pre><pre>def flight(self):</pre><pre>print(“Parrots can fly”)</pre><pre>class penguin(Bird):</pre><pre>def flight(self):</pre><pre>print(“Penguins do not fly”)</pre><pre>obj_bird = Bird()</pre><pre>obj_parr = parrot()</pre><pre>obj_peng = penguin()</pre><pre>obj_bird.intro()</pre><pre>obj_bird.flight()</pre><pre>obj_parr.intro()</pre><pre>obj_parr.flight()</pre><pre>obj_peng.intro()</pre><pre>obj_peng.flight()</pre><p><strong>OUTPUT</strong></p><pre>There are different types of birds</pre><pre>Most of the birds can fly but some cannot</pre><pre>There are different types of bird</pre><pre>Parrots can fly</pre><pre>There are many types of birds</pre><pre>Penguins do not fly</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1df8ad180a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Oriented Concepts]]></title>
            <link>https://medium.com/@shanmu1601/object-oriented-concepts-c3020ed50476?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3020ed50476</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[class]]></category>
            <category><![CDATA[oops-concepts]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Fri, 20 May 2022 01:49:01 GMT</pubDate>
            <atom:updated>2022-05-24T16:04:34.066Z</atom:updated>
            <content:encoded><![CDATA[<p>Python, like other general-purpose programming languages, has always been an object-oriented language. It enables us to create applications in an Object-Oriented manner. We can easily construct and use classes and objects in Python.</p><p>The following are the main principles of an object-oriented programming system:</p><p>1. Class</p><p>2. Object</p><p>3. Method</p><p>4. Inheritance</p><p>5. Polymorphism</p><p>6. Data Abstraction</p><p>7. Encapsulation</p><p><strong>CLASS</strong></p><p>Classes allow you to group data and functionality together. A new class introduces a new type of object, allowing for the creation of new instances of that type. For state maintenance, each class instance can have attributes connected to it. Class instances can additionally have methods for changing their state (specified by their class).</p><p>SYNTAX</p><pre>class ClassName:</pre><pre># Statement-1</pre><pre>.</pre><pre>.</pre><pre># Statement-N</pre><p><strong>OBJECT</strong></p><p>The object is a separate entity with its own state and behaviour. It might be a mouse, keypad, table, desk, pencil, or any other real-world object. Objects include integers, strings, floating-point numbers, arrays, and dictionaries. Any single number or string, to be more specific, is an object.</p><p>SYNTAX</p><p>objectName=className()</p><p><strong>INHERITANCE</strong></p><p>The most significant feature of object-oriented programming is inheritance, which mirrors the real-world idea. It states that the child object inherits all of the parent object’s properties and behaviours. We can design a class that inherits all of the properties and behaviours of another class by utilising inheritance. The new class is known as a derived class or child class, whereas the base class or parent class is recognised as the one whose properties are gained.It ensures that the code can be reused.</p><p><strong>EXAMPLE</strong></p><pre>class Parent:</pre><pre>def show(self):</pre><pre>print(“Parent”)</pre><pre>class Child(Parent):</pre><pre>def display(self):</pre><pre>print(“Child”)</pre><pre>d = Child()</pre><pre>d.display()</pre><pre>d.show()</pre><p><strong>OUTPUT</strong></p><pre>Child</pre><pre>Parent</pre><p><strong>POLYMORPHISM</strong></p><p>Polymorphism is made up of two words: poly and morphs. Poly stands for “many,” while morph stands for “form.” We understand polymorphism as the ability to complete a task in multiple ways. For instance, suppose you have a class animal and all of the animals speak. However, they communicate in distinct ways. In this case, the “talk” behaviour is polymorphic and dependent on the animal. As a result, while the abstract concept of “animal” does not literally “talk,” individual animals (such as dogs and cats) have a concrete execution of the action “speak.”</p><p><strong>ENCAPSULATION</strong></p><p>One of the core principles in object-oriented programming is encapsulation (OOP). It discusses the concept of data wrapping and the methods that operate with data as a single unit. This prevents data from being accidentally modified by restricting direct access to variables and methods. An object’s variable can only be altered by an object’s method to prevent unintentional changes. These variables are referred to as private variables. Encapsulation is demonstrated by a class, which encapsulates all of the data included in member functions, variables, and so on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3020ed50476" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Datatypes of python]]></title>
            <link>https://medium.com/@shanmu1601/datatypes-of-python-16004cb7f264?source=rss-c9695e64eed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/16004cb7f264</guid>
            <category><![CDATA[datatypes-in-python]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shanmugapriya]]></dc:creator>
            <pubDate>Thu, 19 May 2022 13:54:47 GMT</pubDate>
            <atom:updated>2022-05-19T13:54:47.153Z</atom:updated>
            <content:encoded><![CDATA[<p>Every programming language uses datatypes. So what are they? Datatypes are categorization of the data items. It denotes the kind of value that specifies which operations can be performed on a given set of data. These datatypes are classified into five different types and they are:</p><p>1. Numeric</p><p>2. Sequence Type</p><p>3. Boolean</p><p>4. Set</p><p>5. Dictionary</p><p><strong>NUMERIC</strong></p><p>Numeric data types in Python represent data with a numeric value. Integers, floating numbers, and even complex numbers can be used as numerical values. In Python, these values are represented by the int, float, and complex classes.</p><p>⦁ Integers — The int class represents this value. It contains full numbers that are either positive or negative . There is no limit on how lengthy an integer value can be in Python.</p><p>⦁ Float — It is a floating point representation of a real number. A decimal point is used to specify it. To express scientific notation, the characters e or E followed by a positive or negative number might be inserted</p><p>⦁ Complex Numbers — The complex class represents a complex number. It is described as real part + (imaginary part)j</p><p><strong>SEQUENCE TYPE</strong></p><p>Sequences allow you to organise and store many data in an efficient and structured manner. There are various different sorts of sequences.Those involved in python are string, list and tuple.</p><p>⦁ String-In Python, a string is defined as a collection of characters enclosed in quotation marks. Python supports single and double quotes in pairs. The slice operator ([] and [:]) can be used to extract subsets of strings, with indexes starting at 0 at the beginning of the string and working their way to -1 at the end.</p><p>⦁ List-The most versatile of Python’s compound data types are lists. Items are separated by commas and enclosed in square brackets in a list []. Lists are similar to arrays in C in certain ways. One distinction is that all elements in a list can be of different data types.</p><p>⦁ Tuple-A tuple is a sequence data type that functions similarly to a list. A tuple is a collection of values that are separated by commas. Tuples, unlike lists, are surrounded by parenthesis ()</p><p><strong>BOOLEAN</strong></p><p>Booleans represent one of the two values: True or False. You’ll frequently need to know if an expression is True or False in programming. In Python, you may evaluate any expression and get one of two results: True or False. When you compare two values, Python evaluates the expression and produces a Boolean answer.</p><p><strong>SET</strong></p><p>Multiple items can be stored in a single variable using sets. Set is one of four built-in Python data types for storing collections of data; the other three are List, Tuple, and Dictionary, all of which have different properties and applications. A set is an unsorted, unchangeable*, and unindexed collection. Set items cannot be changed, but you can remove and replace them. Curly brackets are used to write sets.</p><p><strong>DICTIONARY</strong></p><p>In Python, a dictionary is an unordered collection of data values that may be used to store data values like a map. Unlike other Data Types that can only carry a single value as an element, Dictionary can hold key:value pairs. The dictionary includes key-value pairs to make it more efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16004cb7f264" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>