<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shiva yada</title>
    <description>The latest articles on DEV Community by shiva yada (@shiva_yada).</description>
    <link>https://dev.to/shiva_yada</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1018011%2F9f89c03e-6db2-4b71-85c6-c8a680cb4e0c.png</url>
      <title>DEV Community: shiva yada</title>
      <link>https://dev.to/shiva_yada</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiva_yada"/>
    <language>en</language>
    <item>
      <title>Django</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Tue, 04 Apr 2023 11:11:24 +0000</pubDate>
      <link>https://dev.to/shiva_yada/django-2oan</link>
      <guid>https://dev.to/shiva_yada/django-2oan</guid>
      <description>&lt;h3&gt;
  
  
  Settings file
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. What is secret key?
&lt;/h4&gt;

&lt;p&gt;In Django, the SECRET_KEY setting is a value used for cryptographic signing and should be kept secret. It is used for various security purposes such as generating unique session IDs, creating CSRF tokens, and signing cookies. If an attacker gains access to your SECRET_KEY, they could potentially hijack user sessions or perform other malicious actions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is declared in &lt;code&gt;settings.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. What are the default Django apps inside it? Are there more?
&lt;/h4&gt;

&lt;p&gt;The default Django apps that come with a new Django project are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.admin&lt;/code&gt; : A built-in admin interface for managing Django models and data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.auth&lt;/code&gt; : A built-in authentication system for user management and authentication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.contenttypes&lt;/code&gt; : A framework for working with content types, which allows you to associate arbitrary data with models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.sessions&lt;/code&gt; : A framework for handling user sessions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.messages&lt;/code&gt; : A framework for displaying user messages, such as success or error messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;django.contrib.staticfiles&lt;/code&gt; : A framework for managing static files, such as CSS and JavaScript files.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. What is middleware? What are different kinds of middleware? Read up a little on each security issue.
&lt;/h4&gt;

&lt;p&gt;Middleware refers to a layer of software that sits between different applications or systems, facilitating communication and data exchange between them.&lt;/p&gt;

&lt;p&gt;Different kinds of middleware:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Application server middleware&lt;/strong&gt; : This type of middleware provides a platform for developing, deploying, and running enterprise applications. Examples of application server middleware include JavaEE, Microsoft.NET.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Message-oriented Middleware&lt;/strong&gt;: This type of middleware enables different applications to communicate with each other through the exchange of messages. Examples of message-oriented middleware include IBM MQ and Apache Kafka.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database Middleware&lt;/strong&gt;: This type of middleware provides an abstraction layer between applications and databases, allowing developers to work with databases using standard APIs. Examples of database middleware include JDBC and ODBC.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Middleware&lt;/strong&gt;: This type of middleware provides services that enable web-based applications to function properly. Examples of web middleware include Apache Tomcat and Microsoft IIS.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Common security issues with middleware include:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authentication and Authorization&lt;/strong&gt;: Middleware is often used to manage authentication and authorization for applications, making it a prime target for attackers. If middleware is not properly secured, it can be vulnerable to attacks such as credential stuffing and brute force attacks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Leakage&lt;/strong&gt;: Middleware can sometimes be configured to log sensitive data, such as user credentials, in clear text. This can leave the data vulnerable to interception by attackers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Injection Attacks&lt;/strong&gt;: Middleware that handles user input, such as web middleware, can be vulnerable to injection attacks, such as SQL injection and cross-site scripting (XSS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Denial of Service&lt;/strong&gt;: Middleware that is not properly configured or secured can be vulnerable to denial-of-service (DoS) attacks, which can bring down an entire application or system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSRF&lt;/strong&gt; ?&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CSRF (Cross-Site Request Forgery) is a type of security vulnerability that allows an attacker to trick a user into unintentionally performing an action on a website without their knowledge or consent.&lt;/p&gt;

&lt;p&gt;To protect against CSRF attacks, website owners can implement measures such as CSRF tokens, which are unique and random values that are included in each request and verified by the server to ensure that the request came from an authorized source.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. &lt;strong&gt;XSS&lt;/strong&gt; ?
&lt;/h4&gt;

&lt;p&gt;Cross-site scripting (XSS) is a type of cyber attack where an attacker injects malicious code or scripts into a trusted website or application. They do this by sending a link to a user and tricking them into clicking it. If the website or application does not properly check the data it receives, the malicious code can execute on the user's system.&lt;/p&gt;

&lt;p&gt;This allows the attacker to steal important information, such as the user's login details or session cookie. Essentially, an XSS attack can allow an attacker to take control of a website or application, and use it for their own purposes.&lt;/p&gt;

&lt;h4&gt;
  
  
  7. &lt;strong&gt;Click Jacking&lt;/strong&gt; ?
&lt;/h4&gt;

&lt;p&gt;Clickjacking is a type of cyber attack where an attacker tries to trick a user into clicking on something on a website or application that they did not intend to click on. This is usually done by overlaying a transparent or disguised element, such as a button or link, over a legitimate element on the website or application.&lt;/p&gt;

&lt;h4&gt;
  
  
  8. What is (WSGI)[&lt;a href="https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface"&gt;https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface&lt;/a&gt;]?
&lt;/h4&gt;

&lt;p&gt;WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Models file
&lt;/h2&gt;

&lt;h4&gt;
  
  
  1. What is ondelete Cascade?
&lt;/h4&gt;

&lt;p&gt;On delete cascade is used to automatically remove the matching records from the child table when we delete the rows from the parent table. It is a kind of referential action related to the foreign key.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. A broad understanding of Fields and Validators available to you.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Fields&lt;/strong&gt;: Fields are used to define the type of data that can be entered into a specific form element, such as text boxes, radio buttons, checkboxes, etc. The most common types of fields include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Text fields&lt;/strong&gt;: Used for entering text data, such as names, addresses, and descriptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Numeric fields&lt;/strong&gt;: Used for entering numerical data, such as age, quantity, and price.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Date fields&lt;/strong&gt;: Used for entering dates and times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boolean fields&lt;/strong&gt;: Used for entering true/false or yes/no data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File fields&lt;/strong&gt;: Used for uploading files, such as images, documents, and videos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dropdown fields&lt;/strong&gt;: Used for selecting one option from a list of options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Validators&lt;/strong&gt;: Validators are used to ensure that the data entered into a form element meets the required standards. Validators typically check for the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Required fields&lt;/strong&gt;: Ensures that a specific field is not left blank.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data format&lt;/strong&gt;: Ensures that data is entered in the correct format, such as a valid email address, phone number, or credit card number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data range&lt;/strong&gt;: Ensures that data falls within a specified range, such as a minimum and maximum value.&lt;br&gt;
&lt;strong&gt;Data type&lt;/strong&gt;: Ensures that data is of the correct data type, such as a number or text.&lt;br&gt;
    Custom validation: Allows developers to define their own validation rules based on their specific requirements.&lt;/p&gt;

&lt;p&gt;Fields and validators play a critical role in ensuring that user data is accurate and consistent, reducing the risk of errors and data loss. By understanding how to use these tools effectively, developers can create more robust and reliable software applications.&lt;/p&gt;
&lt;h4&gt;
  
  
  3. Understanding the difference between Python module and Python class?
&lt;/h4&gt;

&lt;p&gt;A module is a file with code that can be used in other programs. It can have functions, classes, and variables, and it's used to organize and reuse code.&lt;/p&gt;

&lt;p&gt;A class is a blueprint for creating objects that have specific behaviors and attributes. It defines variables and functions that the object can have and use. Classes help make code more modular and reusable. While a module can contain multiple classes, a class cannot contain other classes, and it's usually defined within a module.&lt;/p&gt;
&lt;h2&gt;
  
  
  Django ORM
&lt;/h2&gt;
&lt;h4&gt;
  
  
  1. Using ORM queries in Django Shell
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your terminal and navigate to your Django project directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Activate your virtual environment if you have one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the Django Shell by running the command python manage.py shell.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Creating Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a new object in your database using ORM queries, you can use the create method. For example, to create a new Person object with a name and age field, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from myapp.models import Person
person = Person.objects.create(name='John', age=25)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Querying Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To query objects from your database using ORM queries, you can use the filter method. For example, to get all Person objects with an age greater than or equal to 18, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;people = Person.objects.filter(age__gte=18)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Updating Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To update objects in your database using ORM queries, you can use the update method. For example, to update the age field of all Person objects with a name of 'John', you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Person.objects.filter(name='John').update(age=26)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deleting Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To delete objects from your database using ORM queries, you can use the delete method. For example, to delete all Person objects with an age less than 18, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Person.objects.filter(age__lt=18).delete()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Turning ORM to SQL in Django Shell
&lt;/h4&gt;

&lt;p&gt;In Django, you can convert ORM (Object-Relational Mapping) queries to SQL (Structured Query Language) queries in the Django shell using the query method on a queryset object.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Start the Django shell by running the command python manage.py shell in your terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import the model that you want to query by running from myapp.models import MyModel (replace myapp and MyModel with the appropriate app name and model name).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get a queryset for the model by running qs = MyModel.objects.all().&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Call the query method on the queryset to get the corresponding SQL query by running qs.query.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. What are Aggregations?
&lt;/h4&gt;

&lt;p&gt;Aggregations are a way to group and summarize data in a database or a data structure. In the context of databases, aggregations are often used to calculate statistics, such as averages, counts, sums, and maximum or minimum values.&lt;/p&gt;

&lt;p&gt;In Python, aggregations are often performed using libraries such as NumPy or Pandas.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. What are Annotations?
&lt;/h4&gt;

&lt;p&gt;In Django, annotations allow you to add calculated fields to the queryset that are not part of the model definition. Annotations are useful when you need to perform calculations or add additional information to the queryset.&lt;/p&gt;

&lt;p&gt;Annotations are created using the annotate method on the queryset. The annotate method takes one or more arguments, which are expressions that define the new field(s) to be added to the queryset. These expressions can be built using Django's query expression API, which provides a set of classes and functions for constructing complex database queries.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. What is a migration file? Why is it needed?
&lt;/h4&gt;

&lt;p&gt;Migration files in Django are Python files that contain instructions for updating the database schema to match changes in the model definition. They are generated automatically by the makemigrations command, which analyzes the models and creates a new migration file that represents the changes.&lt;/p&gt;

&lt;p&gt;Migration files are needed because they provide a structured and repeatable way to modify the database schema without manually updating it. When you run the migrate command, Django reads the migration files and applies the changes to the database schema in the order they were created. This ensures that the database schema is always up-to-date with the latest model definition.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. What are SQL transactions? (non ORM concept)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Atomicity: The entire transaction must be completed as a single, indivisible unit, or it must be completely rolled back to its previous state.&lt;/li&gt;
&lt;li&gt;Consistency: The transaction must leave the database in a consistent state; in other words, all constraints must be satisfied.&lt;/li&gt;
&lt;li&gt;Isolation: Transactions must be executed as if they are the only transaction executing on the database; concurrent transactions should not interfere with each other.&lt;/li&gt;
&lt;li&gt; Durability: Once a transaction is committed, its changes are permanent and should be durable even if the system crashes or loses power.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  7. What are atomic transactions?
&lt;/h4&gt;

&lt;p&gt;Atomic transactions are a type of transaction in which all of the statements within the transaction are executed as a single, indivisible unit of work.&lt;/p&gt;

&lt;p&gt;Atomic transactions are often used in database applications to ensure data integrity and consistency. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Revision 13-03-23</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Mon, 13 Mar 2023 05:53:10 +0000</pubDate>
      <link>https://dev.to/shiva_yada/grit-2iei</link>
      <guid>https://dev.to/shiva_yada/grit-2iei</guid>
      <description>&lt;p&gt;1) What is an immediately invoked function expression in JavaScript?&lt;br&gt;
A soon as function is created it invokes itself doesn’t need to invoke explicitly&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(function(value){
    var greet = 'Hello';
    console.log(greet+ ' ' + value); //Hello IIFEs
  })('IIFEs');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) What is the main difference between push() and concat() method in JavaScript?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;push() : Adds one or more elements to the end of an array and returns the new length of the array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    var arr1 = [‘a’, ‘b’, ‘c’];
    var arr2 = [‘d’, ‘e’, ‘f’];
    var arr3 = arr1.push(arr2);
    console.log(arr3); // 4
    console.log(arr1); // [“a”, “b”, “c”, [“d”, “e”, “f”]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;concat() : It is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    var arr1 = [‘a’, ‘b’, ‘c’];
    var arr2 = [‘d’, ‘e’, ‘f’];
    var arr3 = arr1.concat(arr2);
    console.log(arr3); //[“a”, “b”, “c”, “d”, “e”, “f”]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3) What is a callback function in JavaScript?&lt;br&gt;
 A callback function is a function that is passed as an argument to another function, and is executed when that function is called. Callback functions are commonly used in asynchronous programming to handle responses from APIs, databases, or other sources of data.&lt;/p&gt;

&lt;p&gt;4) What is a pass-by-reference and pass-by-value in the context of JavaScript?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pass by Value&lt;/strong&gt;: When a primitive data type, such as a number or a string, is passed as an argument, the function receives a copy of that value. Any changes made to the value inside the function do not affect the original value outside of the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pass by Reference&lt;/strong&gt;: When an object or an array is passed as an argument, the function receives a reference to that object or array. Any changes made to the object or array inside the function affect the original object or array outside of the function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5) What are default parameters in JavaScript?&lt;/p&gt;

&lt;p&gt;Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function fnName(param1 = defaultValue1, /* … ,*/ paramN = defaultValueN) {
  // …
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6) How do we use some() and every() method for arrays in JavaScript?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;some() : The some() method tests whether at least one element in the array passes the test implemented by the provided function. It returns true if, in the array, it finds an element for which the provided function returns true; otherwise it returns false. It doesn't modify the array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const array = [1, 2, 3, 4, 5];

// Checks whether an element is even
const even = (element) =&amp;gt; element % 2 === 0;

console.log(array.some(even));
// Expected output: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;every() : The every() method tests whether all elements in the array pass the test implemented by the provided function. It returns a Boolean value.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const array = [1, 2, 3, 4, 5];

// Checks whether an element is even
const even = (element) =&amp;gt; element % 2 === 0;

console.log(array.every(even));
// Expected output: false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7) What is the NaN function in JavaScript? &lt;/p&gt;

&lt;p&gt;In JavaScript NaN is short for "Not-a-Number".&lt;br&gt;
The isNaN() method returns true if a value is NaN.&lt;br&gt;
The isNaN() method converts the value to a number before testing it.&lt;/p&gt;

&lt;p&gt;8) What is negative indexing in Python?&lt;/p&gt;

&lt;p&gt;Negative Indexing is used to in Python to begin slicing from the end of the string i.e. the last.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9) What are template literals and how do we use them in JavaScript?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Template literals  allow for string interpolation and multi-line strings.&lt;/li&gt;
&lt;li&gt;To create a template literal, enclose your string in backticks.&lt;/li&gt;
&lt;li&gt;The variables are inserted into the string using the ${}.
Template literals can also be nested to build more complex strings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;10) What are the parameters taken by the splice() method in JavaScript? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;start&lt;/em&gt; :
Zero-based index at which to start changing the array, converted to an integer.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;deletecount&lt;/em&gt; :&lt;br&gt;
An integer indicating the number of elements in the array to remove from start.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;item1, …, itemN :&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The elements to add to the array, beginning from start.&lt;/p&gt;

&lt;p&gt;If you do not specify any elements, splice() will only remove elements from the array.&lt;/p&gt;

&lt;p&gt;11) How does the % operator differ for negative numbers in Python and JavaScript? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modulo operator for negative numbers in python:
The sign of the second operand will be sign of result.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//-a%b =  add b to a until we reach 0 or positive integer     print(-10%3) //-10 +3 =-7 +3 = -4 +3 = -1+ 3= 2&lt;/span&gt;

&lt;span class="c1"&gt;//a%-b = subtract b to a until we reach  0 or negative integer&lt;/span&gt;
&lt;span class="nx"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;%-&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 10-3= 7-3= 4-3 = 1-3 = -2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Modulo operator for negative numbers in Javascript:
The sign of first operand will be the sign of result.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// -a%b= - value or 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//-1&lt;/span&gt;

&lt;span class="c1"&gt;// a%-b = + value or 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;%-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//1&lt;/span&gt;

&lt;span class="c1"&gt;// -a%-b = - value or 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;%-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//-1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;12) What Is Prototype Inheritance in JavaScript?&lt;/p&gt;

&lt;p&gt;Prototype inheritance in javascript is the linking of prototypes of a parent object to a child object to share and utilize the properties of a parent class using a child class.&lt;/p&gt;

&lt;p&gt;Prototypes are hidden objects that are used to share the properties and methods of a parent class to child classes.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTML / CSS Concepts</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Thu, 02 Mar 2023 07:42:03 +0000</pubDate>
      <link>https://dev.to/shiva_yada/html-css-concepts-9f0</link>
      <guid>https://dev.to/shiva_yada/html-css-concepts-9f0</guid>
      <description>&lt;h1&gt;
  
  
  Box Model
&lt;/h1&gt;

&lt;p&gt;The box model is a concept in web design that explains how elements on a web page are laid out and sized. Every HTML element is surrounded by a rectangular box, which consists of four parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Content&lt;/strong&gt;: This is where the text, images, and other media are displayed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Padding&lt;/strong&gt;: This is the space between the content and the border of the box.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Border&lt;/strong&gt;: This is the line around the box that separates the content from the padding and margin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Margin&lt;/strong&gt;: This is the space outside the border of the box.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these parts make up the box model. The size and positioning of each box can be adjusted using CSS (Cascading Style Sheets) to create the desired layout and design of a web page.&lt;/p&gt;

&lt;h1&gt;
  
  
  Inline versus Block Elements. Examples.
&lt;/h1&gt;

&lt;p&gt;In HTML, elements can be classified as either inline or block elements, which affects how they are displayed on a web page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Block elements:
&lt;/h3&gt;

&lt;p&gt;Block elements are elements that take up the full width of their parent container and create a new line after the element. Examples of block elements include headings (H1, H2, H3, etc.), paragraphs (p), lists (ul ,ol), and divs. Block elements are typically used for larger sections of content that require a clear separation from surrounding elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inline elements:
&lt;/h3&gt;

&lt;p&gt;Inline elements, on the other hand, only take up the necessary width of their content and do not create a new line after the element. Examples of inline elements include links (a), images (img), and spans. Inline elements are typically used for smaller pieces of content that are part of a larger block element.&lt;/p&gt;

&lt;p&gt;The main difference between inline and block elements is how they affect the flow of content on a web page. Block elements create a new line and push surrounding content down, while inline elements do not affect the flow of content and can be placed within a block element.&lt;/p&gt;

&lt;h1&gt;
  
  
  Positioning: Relative/Absolute
&lt;/h1&gt;

&lt;p&gt;In CSS, positioning refers to the way elements are placed and arranged on a web page. Two common types of positioning are relative and absolute.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relative positioning&lt;/strong&gt; is based on the element's original position in the document flow. When an element is given a relative position, it can be moved up, down, left, or right from its original position using the top, bottom, left, and right properties. However, the element still takes up space in the original position, which can affect the positioning of surrounding elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Absolute positioning&lt;/strong&gt;, on the other hand, is based on the element's position relative to its nearest positioned ancestor. When an element is given an absolute position, it is removed from the normal document flow and positioned at a specific point on the page using the top, bottom, left, and right properties. The element does not take up any space in its original position, which means it can overlap other elements on the page.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Summarize that relative positioning moves an element from its original position while still taking up space in the document flow, while absolute positioning positions an element at a specific point on the page relative to its nearest positioned ancestor and does not take up any space in its original position.&lt;/p&gt;

&lt;h1&gt;
  
  
  Common CSS structural classes
&lt;/h1&gt;

&lt;p&gt;In CSS, structural classes are used to apply styling to specific elements based on their position or relationship within the HTML document. Some common CSS structural classes include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.parent&lt;/strong&gt;: This class selects an element that contains another element, known as a child element. It can be used to apply styling to the parent element based on the content of the child element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.child:&lt;/strong&gt; This class selects an element that is contained within another element, known as a parent element. It can be used to apply styling to the child element based on the content of the parent element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.first-child:&lt;/strong&gt; This class selects the first child element of a parent element. It can be used to apply specific styling to the first element in a list, for example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.last-child:&lt;/strong&gt; This class selects the last child element of a parent element. It can be used to apply specific styling to the last element in a list, for example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.nth-child(n):&lt;/strong&gt; This class selects the nth child element of a parent element, where "n" is a number. It can be used to apply styling to specific elements within a list or other type of container.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Common CSS styling classes
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.container&lt;/strong&gt; is often used to define a block-level element that contains other elements, such as a navigation menu or a grid of images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.button&lt;/strong&gt; is a popular class used to style clickable elements on a webpage, such as links or buttons, and can help to improve user engagement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;.&lt;strong&gt;card&lt;/strong&gt; is often used to create a box-like element that contains content, such as a product listing or a news article.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.text-center&lt;/strong&gt; can be used to horizontally center text within an element, such as a heading or a paragraph.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.hidden&lt;/strong&gt; can be used to hide an element from the page entirely, which can be useful for elements that should only be shown under certain conditions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.clearfix&lt;/strong&gt; is a class used to fix issues that can arise when floating elements on a webpage, such as overlapping or misaligned content.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  CSS Specificity
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;CSS specificity is a set of rules that determines which styles should be applied to an element when there are conflicting styles. It is based on the selectors used to target an element in CSS.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The specificity of a selector is determined by the number of ID, class, and element selectors used in the selector. For example, an ID selector has a higher specificity than a class selector, which has a higher specificity than an element selector.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When there are conflicting styles applied to an element, the browser will use the style with the highest specificity. If two styles have the same specificity, the browser will use the style that appears later in the CSS code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By understanding CSS specificity, you can write more efficient and effective CSS code that produces the desired visual result on a web page.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  CSS Responsive Queries
&lt;/h1&gt;

&lt;p&gt;It also know as media queries. These are a way to apply CSS styles based on the size and characteristics of the device or screen that a website is being viewed on. It makes the responsive web design according to the different screens, sizes and resolutions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;767px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;32px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt; rule applies the CSS styles inside the block to the body element when the maximum width of the device is 767 pixels or less.&lt;br&gt;
Some common media query conditions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;min-width:&lt;/strong&gt; applies styles when the screen width is greater than or equal to a specified value&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;max-width:&lt;/strong&gt; applies styles when the screen width is less than or equal to a specified value&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;orientation:&lt;/strong&gt; applies styles based on the orientation of the device (landscape or portrait)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;device-width and device-height:&lt;/strong&gt; applies styles based on the width and height of the device screen&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Flexbox/Grid
&lt;/h1&gt;

&lt;p&gt;Flexbox and Grid are two CSS layout systems that allow you to create more complex and flexible layouts than traditional CSS positioning techniques. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexbox&lt;/strong&gt; is a layout system that allows you to arrange items in a single row or column. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is ideal for creating dynamic and responsive layouts that adjust to different screen sizes. &lt;/li&gt;
&lt;li&gt;Some common properties used with Flexbox include display: flex, flex-direction, justify-content, and align-items.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Grid&lt;/strong&gt; is a two-dimensional layout system that allows you to create complex, multi-column layouts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With Grid, you can create rows and columns, define the size and position of items within the grid, and control the spacing between items.&lt;/li&gt;
&lt;li&gt;Grid include display: grid, grid-template-columns, grid-template-rows, and grid-gap.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;grid-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Common header meta tags
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;title&amp;gt;&lt;/strong&gt; tag: specifies the title of the webpage and is displayed in the browser tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta name="description" content="..."&amp;gt;&lt;/strong&gt;: provides a brief description of the webpage and is often displayed in search engine results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta name="keywords" content="..."&amp;gt;&lt;/strong&gt;: specifies a list of keywords that describe the webpage and can help search engines categorize the content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta name="robots" content="index,follow"&amp;gt;&lt;/strong&gt;: tells search engines whether or not to index the page and follow links on the page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&lt;/strong&gt;: specifies how the webpage should be displayed on different devices and screen sizes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta property="og:title" content="..."&amp;gt;&lt;/strong&gt;: specifies the title of the webpage when shared on social media platforms like Facebook.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;meta property="og:description" content="..."&amp;gt;&lt;/strong&gt;: provides a brief description of the webpage when shared on social media platforms.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  CSS backgrounds
&lt;/h1&gt;

&lt;p&gt;CSS backgrounds allow you to add color, images, and patterns to the background of an element on your webpage. Here are some ways to use CSS backgrounds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solid color&lt;/strong&gt;: You can set a solid background color for an element using the background-color property.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gradient&lt;/strong&gt;: You can create a gradient background using the linear-gradient function.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="nb"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;#ffafbd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;#ffc3a0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image:&lt;/strong&gt; You can use an image as the background of an element using the background-image property.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('image.jpg')&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pattern:&lt;/strong&gt; You can create a pattern background by repeating a small image using the background-image property and the repeat or repeat-x/repeat-y values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('pattern.png')&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-repeat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Position: You can control the position of the background image using the background-position property.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('image.jpg')&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Resources:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//w3schools.com"&gt;w3schools.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/" rel="noopener noreferrer"&gt;MDN DOCS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/css/?ref=gcse" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>impostersyndrome</category>
      <category>debugging</category>
      <category>mentalhealth</category>
      <category>workplace</category>
    </item>
    <item>
      <title>SQL Concepts</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Tue, 21 Feb 2023 10:47:07 +0000</pubDate>
      <link>https://dev.to/shiva_yada/sql-concepts-technical-paper-4opp</link>
      <guid>https://dev.to/shiva_yada/sql-concepts-technical-paper-4opp</guid>
      <description>&lt;h1&gt;
  
  
  ACID Properties
&lt;/h1&gt;

&lt;p&gt;Accessing and modification of the contents of a database using transaction which contain a single logical unit of work with accessing data using read and write operations.&lt;/p&gt;

&lt;p&gt;In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties. &lt;/p&gt;

&lt;h3&gt;
  
  
  Atomicity:
&lt;/h3&gt;

&lt;p&gt;Transactions do not occur partially. Each transaction is considered as one unit and either runs to completion or is not executed at all. Atomicity is also known as the ‘All or nothing rule’. &lt;/p&gt;

&lt;p&gt;Two operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Abort : If transaction aborts, changes made to the database are not visible.&lt;/li&gt;
&lt;li&gt;Commit: if a transaction commits, changes made are visible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Consistency:
&lt;/h3&gt;

&lt;p&gt;The database must be consistent before and after the transaction. It  refers to correctness of database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation:
&lt;/h3&gt;

&lt;p&gt;Multiple transactions occur independently without interference.Changes occurring in a particular transaction will not be visible to any other transaction until that particular change in that transaction is written to memory or has been committed. &lt;/p&gt;

&lt;h3&gt;
  
  
  Durability:
&lt;/h3&gt;

&lt;p&gt;The Changes of a successful transaction occurs even if the system failure occurs. These updates now become permanent and are stored in non-volatile memory. The effects of the transaction, thus, are never lost. &lt;/p&gt;

&lt;p&gt;The ACID properties, in totality, provide a mechanism to ensure the correctness and consistency of a database in a way such that each transaction is a group of operations that acts as a single unit, produces consistent results, acts in isolation from other operations, and updates that it makes are durably stored.&lt;/p&gt;

&lt;h1&gt;
  
  
  CAP Theorem
&lt;/h1&gt;

&lt;p&gt;Cap theorem used to explain some of the completing requirements in a distributed system with replication. &lt;/p&gt;

&lt;p&gt;C- Consistency&lt;br&gt;
A- Availability&lt;br&gt;
P- Partition tolerance&lt;/p&gt;

&lt;p&gt;The CAP theorem states that it is not possible to guarantee all three of the desirable properties – consistency, availability, and partition tolerance at the same time in a distributed system with data replication.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consistency:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consistency means that the nodes will have the same copies of a&lt;br&gt;
replicated data item visible for various transactions. Every node in a distributed cluster returns same(most recent and a successful write).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Availability :&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read and write request for a data item will either successful or failure. For every successful node returns a response for all the read and write requests in a reasonable amount of time.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Partition Tolerance:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system can continue operating even if the network connecting the nodes has a fault that results in two or more partitions, where the nodes in each partition can only communicate among each other. Distributed systems guaranteeing partition tolerance can gracefully recover from partitions once the partition heals. &lt;/p&gt;
&lt;h1&gt;
  
  
  JOINS
&lt;/h1&gt;

&lt;p&gt;SQL Join statement is used to combine data or rows from two or more tables based on a common field between them. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Inner join&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The INNER JOIN keyword selects all rows from both the tables when where condition satisfy. JOIN is same as INNER JOIN.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT table1.column1,table1.column2,table2.column1,....
FROM table1 
INNER JOIN table2
ON table1.matching_column = table2.matching_column;
table1: First table.
table2: Second table
matching_column: Column common to both the tables.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Left join&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This join returns all the rows of the table on the left side of the join and matches rows for the table on the right side of the join.  LEFT JOIN is also known as LEFT OUTER JOIN.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT table1.column1,table1.column2,table2.column1,....
FROM table1 
LEFT JOIN table2
ON table1.matching_column = table2.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Right join&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similar to left join. It returns all the rows of the table on the right side of the join and matching rows for the table on the left side of the join.  RIGHT JOIN is also known as RIGHT OUTER JOIN.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT table1.column1,table1.column2,table2.column1,....
FROM table1 
RIGHT JOIN table2
ON table1.matching_column = table2.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Full join&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FULL JOIN creates the result-set by combining results of both LEFT JOIN and RIGHT JOIN. The result-set will contain all the rows from both tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT table1.column1,table1.column2,table2.column1,....
FROM table1 
FULL JOIN table2
ON table1.matching_column = table2.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Aggregations:
&lt;/h1&gt;

&lt;p&gt;An aggregate function in SQL returns one value after calculating multiple values of a column. We often use aggregate functions with the GROUP BY and HAVING clauses of the SELECT statement.&lt;br&gt;
Various types of SQL aggregate functions are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Count()
The COUNT() function returns the number of rows in a database table.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Syntax:&lt;/p&gt;

&lt;p&gt;COUNT(*)&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;id&lt;/th&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;quantity&lt;/th&gt;
&lt;th&gt;unit_price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;foam&lt;/td&gt;
&lt;td&gt;70&lt;/td&gt;
&lt;td&gt;1.21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;pork&lt;/td&gt;
&lt;td&gt;49&lt;/td&gt;
&lt;td&gt;4.65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Lettuce&lt;/td&gt;
&lt;td&gt;38&lt;/td&gt;
&lt;td&gt;3.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;brocolinni&lt;/td&gt;
&lt;td&gt;90&lt;/td&gt;
&lt;td&gt;4.53&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;sauce&lt;/td&gt;
&lt;td&gt;94&lt;/td&gt;
&lt;td&gt;1.63&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;petit&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;2.39&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;sweet&lt;/td&gt;
&lt;td&gt;98&lt;/td&gt;
&lt;td&gt;3.29&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;island&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;0.74&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT COUNT(id) from PRODUCTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Result:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;count(id)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;SUM() Function
Sum() returns the total sum of a numeric column.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT SUM(unit_price) from products;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Result:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;sum(unit_price)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;21.72&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;AVG()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The AVG() function calculates the average of a set of values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT AVG(quantity) from products;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;AVG(quantity)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;59.875&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;MIN()
MIN() return the lowest value in set of non null values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MIN(quantity) from products;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;MIN(quantity)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;MAX()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MAX() returns the highest value in set of non null values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MAX(quantity) from products;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;MAX(quantity)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;98&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  Filter Clause
&lt;/h1&gt;

&lt;p&gt;The filter clause is another tool for filtering in SQL. The filter clause is used to, as the name suggests, filter the input data to an aggregation function. They differ from the WHERE clause because they are more flexible than the WHERE clause. Only one WHERE clause can be used at a time in a query. While on the other hand, multiple FILTER clauses can be present in a single query.&lt;/p&gt;

&lt;p&gt;Table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;NAME&lt;/th&gt;
&lt;th&gt;EMPLOYED&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Drake Maverick&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Nancy Peloski&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Anakin Skywalker&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Uchiha Obito&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Anakin Skywalker&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;QUERY:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT COUNT(ID)
FILTER(WHERE ID!=2),
AVG(LENGTH(NAME))
FILTER(WHERE LENGTH(NAME)&amp;gt;4)
FROM TEST;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;COUNT&lt;/th&gt;
&lt;th&gt;AVG&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;13.8333333333333333&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  Normalization:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;The process of organizing the data in the database. It is used to minimize the redundancy from a relation or set of relations.&lt;/li&gt;
&lt;li&gt;Normalization divides the larger table into smaller and links them using relationships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data modification anomalies can be categorized into three types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Insertion Anomaly, deletion Anomaly, updatation anomaly. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TYPES OF NORMAL FORMS&lt;/p&gt;

&lt;h4&gt;
  
  
  1NF:
&lt;/h4&gt;

&lt;p&gt;A relation is in 1NF if it contains an atomic value.&lt;br&gt;
The First normal form disallows the multi-valued attribute, composite attribute, and their combinations.&lt;/p&gt;
&lt;h5&gt;
  
  
  2NF:
&lt;/h5&gt;

&lt;p&gt;A relation will be in 2NF if it is in 1NF and all non key attributes are fully functional dependent on the primary key.&lt;/p&gt;
&lt;h4&gt;
  
  
  3NF:
&lt;/h4&gt;

&lt;p&gt;A relation will be in 3NF if it is in 2NF and no transition dependency exists.&lt;br&gt;
The third Normal Form ensures the reduction of data duplication. It is also used to achieve data integrity.&lt;/p&gt;
&lt;h4&gt;
  
  
  BCNF:
&lt;/h4&gt;

&lt;p&gt;A stronger definition of 3NF is known as Boyce Codd's normal form.&lt;br&gt;
The first condition for the table to be in Boyce Codd Normal Form is that the table should be in the third normal form. Secondly, every Right-Hand Side (RHS) attribute of the functional dependencies should depend on the super key of that particular table.&lt;/p&gt;
&lt;h1&gt;
  
  
  Indexes
&lt;/h1&gt;

&lt;p&gt;An index is a schema object. It is used by the server to speed up the retrieval of rows by using a pointer. Reduces disk I/O by using rapid &lt;br&gt;
path access method to locate data quickly. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It speed up select queries and where clauses, but it slows down data input, with the update and the insert statements. &lt;/li&gt;
&lt;li&gt;It can be created or dropped with no effect on the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Creating an Index:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX index
 ON TABLE column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Multi Indexes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; CREATE INDEX index
 ON TABLE (column1, column2,.....);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Unique Indexes:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unique indexes are used for the maintenance of the integrity of the data present in the table as well as for the fast performance, it does not allow multiple values to enter into the table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE UNIQUE INDEX index
 ON TABLE column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Removing an Index:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To remove an index from the data dictionary by using the DROP INDEX command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DROP INDEX index;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Altering an Index:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To modify an existing table’s index by rebuilding, or reorganizing the index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ALTER INDEX IndexName ON TableName REBUILD;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Transactions:
&lt;/h1&gt;

&lt;p&gt;A transaction consist of a sequence of query and/or update statements and is a “unit” of work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The sql standard specifies that a transaction begins implicitly when an SQL statement is executed.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;COMMIT work&lt;/strong&gt; The updates performed by the transaction become permanent in the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ROLLBACK work: All the updates performed by the sql statements in the transaction are undone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Atomic transaction &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;either successful execution or rolled back as if it never occurred.&lt;/p&gt;

&lt;h1&gt;
  
  
  Locking Mechanism
&lt;/h1&gt;

&lt;p&gt;In dbms with multiple users, there is a trade-off between concurrency and consistency. Users need to be able to access data any time, but changes to the database must be done in an orderly sequence that maintains the underlying structure of the data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The locking system is to manage access to resources shared by user databases, tables, pages and rows to guarantee the consistency of the shared data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Concurrency control in database management systems(DBMS) ensures that database transactions are performed concurrently without violating the integrity of the database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Database Isolation Levels
&lt;/h1&gt;

&lt;p&gt;Isolation determines how transaction integrity is visible to other users and systems. It means that a transaction should take place in a system in such a way that it is the only transaction that is accessing the resources in a database system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dirty Read&lt;/strong&gt;: A dirty read is a situation when a transaction reads data that has not yet been committed. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Non Repeatable read&lt;/strong&gt;: Non Repeatable read occurs when a transaction reads the same row twice and gets a different value each time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Phantom Read&lt;/strong&gt; : Phantom read occurs when two same queries are executed,but the rows retrieved by the two, are different.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Isolation levels:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read Uncommitted&lt;/strong&gt;: lowest isolation level.&lt;br&gt;
In this level, one transaction may read not yet committed changes made by other transactions, thereby allowing dirty reads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read Committed&lt;/strong&gt; –in this level it guarantees that any data read is committed at the moment it is read. Transaction holds a read or write lock on the current row,then it prevents from other transactions from reading, updating, or deleting it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repeatable read&lt;/strong&gt;: The transaction holds read locks on all rows it references and writes locks on referenced rows for updates and delete actions. Since other transactions cannot read, update or delete these rows, consequently it avoids non-repeatable read.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serializable&lt;/strong&gt; : Highest isolation level. In this execution of operations in which concurrently executing transactions appears to be serially executing.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Triggers :
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A trigger is a statement that is executed automatically by the system as a side effect of a modification to the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To design a trigger mechanism, we must:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specify the conditions under which the trigger is to be executed.&lt;/li&gt;
&lt;li&gt;Specify the actions to be taken when the trigger executes
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create trigger [trigger_name] 
[before | after]  
{insert | update | delete}  
on [table_name]  
[for each row]  
[trigger_body] 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation of syntax:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create trigger [trigger_name]: Creates or replaces an existing trigger with the trigger_name.&lt;/li&gt;
&lt;li&gt;[before | after]: This specifies when the trigger will be executed.&lt;/li&gt;
&lt;li&gt;{insert | update | delete}: This specifies the DML operation.&lt;/li&gt;
&lt;li&gt;on [table_name]: This specifies the name of the table associated with the trigger.&lt;/li&gt;
&lt;li&gt;[for each row]: This specifies a row-level trigger, i.e., the trigger will be executed for each row being affected.&lt;/li&gt;
&lt;li&gt;[trigger_body]: This provides the operation to be performed as trigger is fired.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE OR REPLACE FUNCTION calculate_marks()
RETURNS TRIGGER AS $$
BEGIN
    NEW.total := NEW.subj1 + NEW.subj2 + NEW.subj3;
    NEW.per := NEW.total * 60 / 100;
    RETURN NEW;
END;
$$ LANGUAGE plpgsql;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TRIGGER stud_marks
BEFORE INSERT ON Student
FOR EACH ROW
EXECUTE FUNCTION calculate_marks();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insert query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;insert into Student values(0, "ABCDE", 20, 20, 20, 0, 0); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select * from Student; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;tid&lt;/th&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;subj1&lt;/th&gt;
&lt;th&gt;subj2&lt;/th&gt;
&lt;th&gt;subj3&lt;/th&gt;
&lt;th&gt;total&lt;/th&gt;
&lt;th&gt;per&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;ABCDE&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;36&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Resources:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/acid-properties-in-dbms/" rel="noopener noreferrer"&gt;Acid-GeeksforGeeks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/BHqjEjzAicA" rel="noopener noreferrer"&gt;CAP-Youtube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/sql/sql_join.asp" rel="noopener noreferrer"&gt;Joins- W3 schools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.simplilearn.com/tutorials/sql-tutorial/sql-aggregate-functions" rel="noopener noreferrer"&gt;Aggregation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.db-book.com/slides-dir/index.html" rel="noopener noreferrer"&gt;db-book&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Solid Principles</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Mon, 20 Feb 2023 06:48:18 +0000</pubDate>
      <link>https://dev.to/shiva_yada/solids-principles-199f</link>
      <guid>https://dev.to/shiva_yada/solids-principles-199f</guid>
      <description>&lt;h1&gt;
  
  
  Solid Principles
&lt;/h1&gt;

&lt;p&gt;The principle of SOLID coding is an acronym originated by Robert C. Martin, and it stands for five different conventions of coding.&lt;/p&gt;

&lt;p&gt;Solids provide five different conventions of coding. Using these principles you can improve the reliability of your code by working on its structure and its logical consistency.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solid principles are:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. The Single-Responsibility Principle(SRP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every component of your code(in class) should have one and only one responsibility. As a consequence of that, there should be only a reason to change it.&lt;/p&gt;

&lt;p&gt;Example: Let us take a list that should used to print the Ascending order , sum of list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;#print Ascending order
&lt;/span&gt;    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ascending order:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;#print sum of list
&lt;/span&gt;    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sum of list:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;#Ascending order: [1, 2, 3, 4, 5]
#Sum of list: 15
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of multiple operations in one function code let us make it more readable by making each method for a operation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_ascending&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="s"&gt;"""print Ascending order"""&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ascending order:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="s"&gt;""" print sum of list"""&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sum of list:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;#return Ascending
&lt;/span&gt;    &lt;span class="n"&gt;get_ascending&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;#return sum of list
&lt;/span&gt;    &lt;span class="n"&gt;get_sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;#Ascending order: [1, 2, 3, 4, 5]
#Sum of list: 15
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of this simple action is that now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easier to localize errors. Any error in execution will point out to a smaller section of code, it give us faster debug phase.&lt;/li&gt;
&lt;li&gt;Part of the code is reusable in other section of your code.&lt;/li&gt;
&lt;li&gt;Easier to create testing for each function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. The Open–closed principle (OCP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should not need to modify the code you have already written to accommodate new functionality, but simply add what you now need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Operations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="s"&gt;'''Operations'''&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Ascending&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Operations&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"The Ascending &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Operations&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="s"&gt;'''Compute sum'''&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"The max is &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s"&gt;'''Main'''&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getoperations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# __subclasses__ will found all classes inheriting from Operations
&lt;/span&gt;        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;operation&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;Operations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__subclasses__&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getoperations&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If now we want to add a new operation e.g.: Average, we will only need to add a class “Average” inheriting from the class “Operations”. The newly formed sub-class will be immediately picked up by &lt;strong&gt;subclasses&lt;/strong&gt;() and no modification in any other part of the code needs to happen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The Liskov substitution principle (LSP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a subclass redefines a function also present in the parent class, a client-user should not be noticing any difference in behaviour, and it is a substitute for the base class.&lt;/p&gt;

&lt;p&gt;The result of this principle is that we’d write our code in a consistent manner and, the end-user will need to learn how our code works, only one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The Interface Segregation Principle (ISP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many client-specific interfaces are better than one general-purpose interface.&lt;br&gt;
The IS principles tell us that a class should only have the interface needed (SRP) and avoid methods that won’t work or that have no reason to be part of that class.&lt;br&gt;
-It occurs when A subclass inherits methods from a base class that it does not need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Mammals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Can Swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Can Walk"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Mammals&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Humans can swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Humans can walk"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Mammals&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Whales can swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Humans can swim
# Humans can walk
# Whales can swim
# Can Walk
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this example, we have got the abstract class “Mammals” that has two abstract methods: “walk” and “swim”. These two elements will belong to the sub-class “Human”, whereas only “swim” will belong to the subclass “Whale”.&lt;/p&gt;

&lt;p&gt;The sub-class whale can still invoke the method “walk” but it shouldn’t, and we must avoid it.&lt;/p&gt;

&lt;p&gt;Code using ISP&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Walker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Can Walk"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Swimmer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Can Swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Walker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Swimmer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Humans can walk"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Humans can swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Swimmer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Whales can swim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="n"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="n"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;Whale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Humans can walk
# Humans can swim
# Whales can swim
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, every sub-class inherits only what it needs, avoiding invoking an out-of-context (wrong) sub-method. That might create an error hard to catch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.  The Dependency Inversion Principle (DIP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Abstractions should not depend on details. Details should depend on abstraction. High-level modules should not depend on low-level modules. Both should depend on abstractions.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Imagine that you have a program that takes in input a specific set of info (a file, a format, etc) and you wrote a script to process it.&lt;br&gt;
What would happen if that info were subject to changes?&lt;br&gt;
You would have to rewrite your script and adjust the new format. Losing the retro compatibility with the older files.&lt;/p&gt;

&lt;p&gt;However, you could solve this by creating a third abstraction that takes the info as input and passes it to the others. &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;Keeping these principles in mind while designing, writing, and refactoring your code so that your code will be much more clean, extendable, and testable. &lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://towardsdatascience.com/solid-coding-in-python-1281392a6a94"&gt;towardsdatascience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PL6n9fhu94yhXjG1w2blMXUzyDrZ_eyOme"&gt;youtube&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>solids</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Object Oriented Programming</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Sun, 19 Feb 2023 12:51:26 +0000</pubDate>
      <link>https://dev.to/shiva_yada/object-oriented-programming-2bf5</link>
      <guid>https://dev.to/shiva_yada/object-oriented-programming-2bf5</guid>
      <description>&lt;h1&gt;
  
  
  Python Object Oriented Programming
&lt;/h1&gt;

&lt;h3&gt;
  
  
  class:
&lt;/h3&gt;

&lt;p&gt;A class is a collection of instance variables and methods that define a particular object. Class is object's templa&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Object Oriented Programming (Python)</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Wed, 15 Feb 2023 11:32:21 +0000</pubDate>
      <link>https://dev.to/shiva_yada/object-oriented-programming-4lgm</link>
      <guid>https://dev.to/shiva_yada/object-oriented-programming-4lgm</guid>
      <description>&lt;h1&gt;
  
  
  Python Object Oriented Programming
&lt;/h1&gt;

&lt;p&gt;Object-oriented programming is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Class:
&lt;/h2&gt;

&lt;p&gt;A class is a collection of instance variables and methods that define a particular object. Class is object's template.&lt;/p&gt;

&lt;p&gt;class is created like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;classname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Object:
&lt;/h2&gt;

&lt;p&gt;A class instance with a defined set of properties is called an object. We can create as many objects as needed for a same class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;student&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;rollno&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rollno&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rollno&lt;/span&gt;
&lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;shiva&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# st is a object calling student class constructor
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;_&lt;em&gt;init&lt;/em&gt;_ is constructor, is used to initialize the student class with attributes such as name,rollno.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inheritance
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Inheritance specifies that the child object acquires all the properties and behaviors of the parent object.&lt;/li&gt;
&lt;li&gt;Using inheritance we can create a class which uses all the properties and behavior of another class.&lt;/li&gt;
&lt;li&gt;The new class is know as a derived class or child class.&lt;/li&gt;
&lt;li&gt;The one whose properties are acquired is known as a base class or parent class.&lt;/li&gt;
&lt;li&gt;Provides the reuse of the code &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Types of Inheritance
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Single Inheritance
&lt;/h4&gt;

&lt;p&gt;A child class acquires the properties and can access all the data from a parent class is called Single Inheritance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Laptop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;laptop working&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Lenovo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Laptop&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;work&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
         &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lenovo working&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Lenovo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;work&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# lenovo working
# laptop working
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Multi-Level Inheritance
&lt;/h4&gt;

&lt;p&gt;A derived class inherits another derived class is called  multi-level inheritance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No limit on the no.of levels up
syntax:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
       &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;animal speaking&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dog barking&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DogChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;eating bread&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DogChild&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Multiple Inheritance
&lt;/h4&gt;

&lt;p&gt;Inherit multiple base classes in the child class is called Multiple Inheritance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Calculation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;Sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Calculation2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;mul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Derived&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Calculation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Calculation2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;Divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Derived&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt; 
60
200
0.5
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Polymorphism:
&lt;/h2&gt;

&lt;p&gt;Polymorphism means ' something that takes on multiple forms'.&lt;br&gt;
A subclass can use a method from its super class as is or modify it as needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;sum2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;sum3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sum2&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;sum3&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;two&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;three&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;two&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;three&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#5
#9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Abstraction:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Abstraction isn't supported directly in Python. Calling a magic method, on the other hand, allows for abstraction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an abstract method is declared in a super class, sub-classes that inherit from the super class must have their own implementation of the method. It hides the  unnecessary info from the user and reduce complexity and increase the efficiency of the program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using abstract classes and methods we can achieve abstraction.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-abc module to use the abstraction&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABC&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;type_shape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
    &lt;span class="c1"&gt;#abstract method
&lt;/span&gt;    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type_shape&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
  &lt;span class="n"&gt;breadth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;breadth&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type_shape&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Area of a rectangle:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;# call to 'area' method defined inside the class.
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Area of a circle:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;# call to 'area' method defined inside the class.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Encapsulation
&lt;/h2&gt;

&lt;p&gt;The process of preventing clients from accessing certain properties,which can only be accessed through specific methods is called Encapsulation.&lt;/p&gt;

&lt;p&gt;Attributes can be inaccessible attributes using two underscores to declare private characteristics.&lt;br&gt;
example : __phonenumber&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;student&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;
        &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__phonenumber&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;232342342&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;shiva&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;8th&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# shiva
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# 8th
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__phonenumber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="c1"&gt;# Attributeerror : no attribute '__phonenumber'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.javatpoint.com/python-tutorial" rel="noopener noreferrer"&gt;Javatpoint&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>String Methods (python)</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Wed, 15 Feb 2023 05:25:20 +0000</pubDate>
      <link>https://dev.to/shiva_yada/string-methods-python-1hel</link>
      <guid>https://dev.to/shiva_yada/string-methods-python-1hel</guid>
      <description>&lt;h2&gt;
  
  
  String Methods
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Slicing&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With slicing we can access substrings. It can get optional start and stop indices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pythonfullstack&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# 'honful'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;strip()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;strip() method makes the string Return a copy of the string with the leading and trailing characters removed. default characters of this method removes whitespace&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;      python    &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;#'python'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;replace()&lt;/strong&gt;
Return a copy of the string with all occurrences of substring old replaced by new.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; hi folks&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hi&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hello&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# ' hello folks'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;split()&lt;/strong&gt;
split() methods uses for returning the list of words in a string, using sep as the delimiter string
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; hi folks good morning&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# ['hi', 'folks', 'good' ,'morning']
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;join()&lt;/strong&gt; 
Return a string which is the concatenation of the strings in iterable.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hi&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;folks&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;good&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;morning&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# 'hi folks good morning'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;upper(), lower(), capitalize()&lt;/strong&gt;
Return a copy of the string with all the cased characters converted to uppercase, lowercase, or first character capitalized and the rest lowercased.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;python&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;#'PYTHON'
&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pyThOn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# 'python'
&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pyTHoN&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;capitalize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# 'Python'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;isalpha(), isnumeric(), isalnum()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;isalpha() is to check a string whether it contains alphabets only.&lt;/p&gt;

&lt;p&gt;isnumeric() is to check a string whether it contains numbers only.&lt;/p&gt;

&lt;p&gt;isalnum() is to check a string whether it contains alphabets or  numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;justchill&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isalpha&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;#output : True
&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;9887&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isnumeric&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# output: True
&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;30jno&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isalnum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;#output: True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;count()&lt;/strong&gt;
count() method is used to count the particular substrings in a string.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hello&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;l&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# 2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;find()&lt;/strong&gt;
Return the lowest index in the string where substring sub is found within the slice s[start:end]
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;run python&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;y&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# 5
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;swapcase()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Return a copy of the string with uppercase characters converted to lowercase and vice versa.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;HeLLo&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;swapcase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# 'hEllO'
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>gratitude</category>
      <category>writing</category>
    </item>
    <item>
      <title>Array Methods (Python)</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Tue, 14 Feb 2023 10:45:24 +0000</pubDate>
      <link>https://dev.to/shiva_yada/array-methods-python-188c</link>
      <guid>https://dev.to/shiva_yada/array-methods-python-188c</guid>
      <description>&lt;p&gt;Python has a set of built-in methods that you can use on lists/arrays.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;append()&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adds an element at the end of the array/list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ar&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[1,2,3,5,7])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;insert(pos, value)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Inserts an element at desired position of the array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[1,7,2,3,5])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;remove(value)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To remove an element from the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',1,2,5])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;extend(arr)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding another array to a existing array using extend method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[1,2,3,5,33,55])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;pop()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pop method removes the last element in array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[1,2,3])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;index(value)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To know the index of a value in an array using index(val) method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;#output: 2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;reverse()&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To reverse an array use reverse() method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[5,3,2,1])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromlist(list)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;fromlist() is used to add a list to the end of the array. It will take a list as its input argument and the output of this function is an array with list appended at the end of the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromlist&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#output:  array('i',[1,2,3,5,10,7,3])
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;count(val)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;count() will tell the total number of occurrences of the given value in the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;i&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;#output:  4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.educba.com/python-array-functions/" rel="noopener noreferrer"&gt;Educba&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>motivation</category>
    </item>
    <item>
      <title>Prevention of Sexual Harassment</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Tue, 14 Feb 2023 08:37:30 +0000</pubDate>
      <link>https://dev.to/shiva_yada/prevention-of-sexual-harassment-1193</link>
      <guid>https://dev.to/shiva_yada/prevention-of-sexual-harassment-1193</guid>
      <description>&lt;h3&gt;
  
  
  1. What kinds of behaviour cause sexual harassment?
&lt;/h3&gt;

&lt;p&gt;Sexual harassment can take many forms and can include a wide range of behaviors. Some common examples of behaviors that may constitute sexual harassment include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unwanted sexual advances or propositions
Verbal harassment, such as sexual slurs, comments, or jokes.&lt;/li&gt;
&lt;li&gt;Physical harassment, such as unwanted touching, hugging, or kissing.&lt;/li&gt;
&lt;li&gt;Displaying or distributing sexually explicit material, such as photographs or videos.&lt;/li&gt;
&lt;li&gt;Sending sexually suggestive emails, text messages, or letters.&lt;/li&gt;
&lt;li&gt;Threatening retaliation if a sexual favor is not granted.&lt;/li&gt;
&lt;li&gt;Making sexual gestures or motions.&lt;/li&gt;
&lt;li&gt;Making sexual comments about an individual's clothing, body, or sexual activities.&lt;/li&gt;
&lt;li&gt;Stalking or following someone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's important to note that these behaviors can be physical, verbal, or nonverbal, and can be committed by a supervisor, coworker, or even a non-employee, such as a vendor or customer.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. What would you do in case you face or witness any incident or repeated incidents of such behaviour
&lt;/h3&gt;

&lt;p&gt;If you experience or witness sexual harassment, you should take these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write down what happened in detail about incident.&lt;/li&gt;
&lt;li&gt;Report it to a supervisor or authority figure&lt;/li&gt;
&lt;li&gt;Keep a record of your report&lt;/li&gt;
&lt;li&gt;Talk to someone for support: talk to a trusted friend, family member, or a counselor to help you cope with the emotional impact of the harassment.&lt;/li&gt;
&lt;li&gt;Consider filing a complaint: you may consider filing a complaint with the Equal Employment Opportunity Commission (EEOC) or a similar agency.&lt;/li&gt;
&lt;li&gt;Consult a lawyer for legal advice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By taking these steps, you can help protect yourself and hold those responsible for the harassment accountable.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learning Process</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Fri, 10 Feb 2023 13:01:00 +0000</pubDate>
      <link>https://dev.to/shiva_yada/learning-process-2mab</link>
      <guid>https://dev.to/shiva_yada/learning-process-2mab</guid>
      <description>&lt;p&gt;``&lt;/p&gt;

&lt;h3&gt;
  
  
  1. How to Learn Faster with the Feynman Technique
&lt;/h3&gt;

&lt;p&gt;Video - 5:47 minutes - &lt;a href="https://www.youtube.com/watch?v=_f-qkGJBPts"&gt;https://www.youtube.com/watch?v=_f-qkGJBPts&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 1
&lt;/h3&gt;

&lt;p&gt;What is the Feynman Technique? Paraphrase the video in your own words.&lt;/p&gt;

&lt;p&gt;The Feynman Technique is a four-step method for grasping any subject.&lt;br&gt;
This method avoids automated recall in favor of true comprehension gained through selection, research, writing, explaining, and refining. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select a concept to study.&lt;br&gt;
Choose a topic that interests you and write it at the top of a blank page in a notebook.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Teach it to yourself or others.&lt;br&gt;
Make a list of everything you know about a subject and explain it to yourself. Alternatively, teach it to someone else.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you get stuck, go back to the source material.&lt;br&gt;
Return to whatever you're learning from - a book, lecture notes, podcast - and fill in the blanks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make analogies and simplify your explanations.&lt;br&gt;
Streamline your notes and explanation, clarifying the subject until it appears obvious. Additionally, consider analogies that feel natural. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Question 2
&lt;/h2&gt;

&lt;p&gt;What are the different ways to implement this technique in your learning process?&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Learning How to Learn TED talk by Barbara Oakley
&lt;/h3&gt;

&lt;p&gt;Video - 17:50 minutes - &lt;a href="https://www.youtube.com/watch?v=O96fE1E-rf8"&gt;https://www.youtube.com/watch?v=O96fE1E-rf8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are some ways to implement the techniques discussed in Barbara Oakley's "Learning How to Learn" TED talk in your learning process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Alternating between focused and diffuse modes of thinking&lt;/li&gt;
&lt;li&gt;Using the Pomodoro Technique, 25 min work then 5 min break for four seasons.&lt;/li&gt;
&lt;li&gt;Incorporating "desirable difficulties" into study routine&lt;/li&gt;
&lt;li&gt;Getting enough sleep&lt;/li&gt;
&lt;li&gt;Taking regular breaks&lt;/li&gt;
&lt;li&gt;Chunking information into smaller pieces&lt;/li&gt;
&lt;li&gt;Experiment to find what works best.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Question 3
&lt;/h3&gt;

&lt;p&gt;Paraphrase the video in detail in your own words.&lt;/p&gt;

&lt;p&gt;Barbara Oakley's "Learning How to Learn" TED talk highlights the importance of using effective techniques for better learning and retention. The speaker discusses the two modes of thinking, focused and diffuse, and explains how alternating between these modes can aid in learning. The Pomodoro Technique, where one works for 25 minutes and takes a five-minute break, is also discussed. "Desirable difficulties," making learning a little harder to improve memory, is also highlighted. Oakley stresses the importance of getting enough sleep and taking regular breaks for improved learning and retention. The talk emphasizes the need to find what works best for each individual and encourages experimenting with different techniques.&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 4
&lt;/h3&gt;

&lt;p&gt;What are some of the steps that you can take to improve your learning process?&lt;/p&gt;

&lt;p&gt;To improve my learning process, consider the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Alternating between focused and diffuse modes of thinking: In focused mode, concentrate on a task, and in diffuse mode, let my mind relax and wander.&lt;/li&gt;
&lt;li&gt;Using the Pomodoro Technique: Work for 25 minutes, take a five-minute break, and repeat. This helps to stay focused and manage time &lt;/li&gt;
&lt;li&gt;Incorporating "desirable difficulties" into my study routine: Make learning a little harder to improve &lt;/li&gt;
&lt;li&gt;Getting enough sleep: Sleep is crucial for memory consolidation.&lt;/li&gt;
&lt;li&gt;Taking regular breaks: Regular breaks can help me stay refreshed&lt;/li&gt;
&lt;li&gt;Chunking information into smaller pieces: Breaking down information into smaller, manageable pieces can make it easier to understand and &lt;/li&gt;
&lt;li&gt;Experimenting with different techniques: Find what works best for me by trying out different methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Learn Anything in 20 hours
&lt;/h3&gt;

&lt;p&gt;Watch the video in totality first. Recommend watching in 1 sitting. Video - 20 minutes - &lt;a href="https://www.youtube.com/watch?v=5MgBikgcWnY"&gt;https://www.youtube.com/watch?v=5MgBikgcWnY&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 5
&lt;/h3&gt;

&lt;p&gt;Your key takeaways from the video? Paraphrase your understanding.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Breaking down the skill or subject into smaller, manageable parts&lt;/li&gt;
&lt;li&gt;Focusing on the most important information and skills&lt;/li&gt;
&lt;li&gt;Practicing and applying the knowledge immediately&lt;/li&gt;
&lt;li&gt;Finding a mentor or learning from experts&lt;/li&gt;
&lt;li&gt;Staying motivated and continuously practicing&lt;/li&gt;
&lt;li&gt;Using spaced repetition and interleaving to improve retention&lt;/li&gt;
&lt;li&gt;Incorporating deliberate practice to improve performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These steps can help anyone learn a new skill or subject in 20 hours by focusing on the most important information, practicing regularly, and continuously refining their approach. Additionally, seeking guidance from mentors or experts and staying motivated throughout the process can also aid in the learning process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 6
&lt;/h3&gt;

&lt;p&gt;What are some of the steps that you can while approaching a new topic?&lt;/p&gt;

&lt;p&gt;Here are some steps to approach a new topic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Breaking down the topic into smaller parts: Understanding the topic in smaller, manageable pieces can make it easier to learn.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Focusing on the most important information: Identify the key information and concepts that are essential to understanding the topic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Researching and gathering information: Read books, articles, and other resources to gather information on the topic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finding a mentor or learning from experts: Seek guidance from mentors or experts in the field to gain a deeper understanding of the topic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Active learning: Engage with the material by summarizing it, teaching it to someone else, or taking notes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Practice: Apply the knowledge through practice problems or real-world scenarios.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Staying motivated: Set specific goals and stay motivated to keep learning. Continuously evaluating and refining your approach can also aid in the learning process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Linux basics</title>
      <dc:creator>shiva yada</dc:creator>
      <pubDate>Thu, 02 Feb 2023 05:43:46 +0000</pubDate>
      <link>https://dev.to/shiva_yada/linux-basics-1hjj</link>
      <guid>https://dev.to/shiva_yada/linux-basics-1hjj</guid>
      <description>&lt;h2&gt;
  
  
  Linux :
&lt;/h2&gt;

&lt;p&gt;A family of open-source Unix-like operating systems based on the Linux kernel. A text-based user interface for your computer is the Linux command line. It can appear to be complicated and difficult to use because it is frequently referred to as the shell, terminal, console, prompt, or by several other names.&lt;/p&gt;

&lt;h4&gt;
  
  
  Terminal:
&lt;/h4&gt;

&lt;p&gt;Commands are written here for specific tasks.&lt;br&gt;
Two ways to open terminal emulator:&lt;br&gt;
1) Go to search box type "terminal" then it shows click on it.&lt;br&gt;
2) Short-cut ctrl + alt + t&lt;/p&gt;

&lt;h4&gt;
  
  
  Basics Commands to know
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command line&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ls&lt;/td&gt;
&lt;td&gt;Lists all files and directories in the present working directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ls – R&lt;/td&gt;
&lt;td&gt;Lists files in sub-directories as well&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ls – a&lt;/td&gt;
&lt;td&gt;Lists hidden files as well&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ls – al&lt;/td&gt;
&lt;td&gt;Lists files and directories with detailed information like permissions, size, owner, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cat &amp;gt; filename&lt;/td&gt;
&lt;td&gt;Creates a new file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cat filename&lt;/td&gt;
&lt;td&gt;Displays the file content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cat file1 file2 &amp;gt; file3&lt;/td&gt;
&lt;td&gt;Joins two files (file1, file2) and stores the output in a new file (file3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mv file “new file path”&lt;/td&gt;
&lt;td&gt;Moves the files to the new location&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mv filename new_file_name&lt;/td&gt;
&lt;td&gt;Renames the file to a new filename&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sudo&lt;/td&gt;
&lt;td&gt;Allows regular users to run programs with the security privileges of the superuser or root&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rm filename&lt;/td&gt;
&lt;td&gt;Deletes a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;man&lt;/td&gt;
&lt;td&gt;Gives help information on a command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;history&lt;/td&gt;
&lt;td&gt;Gives a list of all past basic Linux commands list typed in the current terminal session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;clear&lt;/td&gt;
&lt;td&gt;Clears the terminal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mkdir directoryname&lt;/td&gt;
&lt;td&gt;Creates a new directory in the present working directory or a at the specified path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rmdir&lt;/td&gt;
&lt;td&gt;Deletes a directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mv&lt;/td&gt;
&lt;td&gt;Renames a directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;apt-get&lt;/td&gt;
&lt;td&gt;Command used to install and update packages&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  File System
&lt;/h3&gt;

&lt;p&gt;A Linux file system is a built-in layer of a Linux operating system that is used to manage storage data. It aids in the organisation of files on disc storage. It manages a file's name, size, creation date, and much more information.&lt;/p&gt;

&lt;p&gt;The Linux file system contains the following sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The root directory (/)&lt;/li&gt;
&lt;li&gt;A specific data storage format (EXT3, EXT4, BTRFS, XFS and so on)&lt;/li&gt;
&lt;li&gt;A partition or logical volume having a particular file system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Kernal
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Linux kernel is a free, open-source, multitasking, modular, monolithic, and Unix-like operating system kernel. Linus Torvalds created it in 1991 for his i386-based PC and it was quickly adopted as the kernel for the GNU operating system, which was written to be a libre (free) replacement for Unix.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Linux is distributed under the GNU General Public License v2, but it includes files licensed under other compatible licenses. Since late 1990, it has been included in a number of operating system distributions, many of which are also commonly referred to as Linux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The GCC GNU extensions to the C programming language are used to write almost all of the Linux kernel code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It generates a highly optimized vmlinux (executable) to maximize task execution time and memory space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Daily development discussions focus on the LKML (Linux Kernel mailing list).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Changes are tracked using the git version control system, which Torvalds created for BitKeeper as a free software replacement.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Folder Structure
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzx2we7k0pvg28hk900v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzx2we7k0pvg28hk900v.png" alt="Image description" width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>crypto</category>
      <category>web3</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
