<?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: Anshika Bhatnagar</title>
    <description>The latest articles on DEV Community by Anshika Bhatnagar (@bhatnagaranshika02).</description>
    <link>https://dev.to/bhatnagaranshika02</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%2F379829%2Fd8f9e6e5-4202-4760-b27d-f1b2938d577e.jpeg</url>
      <title>DEV Community: Anshika Bhatnagar</title>
      <link>https://dev.to/bhatnagaranshika02</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bhatnagaranshika02"/>
    <language>en</language>
    <item>
      <title>Optimized Balanced Paranthesis solution in Python.</title>
      <dc:creator>Anshika Bhatnagar</dc:creator>
      <pubDate>Tue, 08 Sep 2020 04:31:25 +0000</pubDate>
      <link>https://dev.to/bhatnagaranshika02/optimized-balanced-paranthesis-solution-in-python-652</link>
      <guid>https://dev.to/bhatnagaranshika02/optimized-balanced-paranthesis-solution-in-python-652</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem Statement: &lt;br&gt;
Given an expression string, write a python program to find whether a given string has balanced parenthesis or not.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample Test Case&lt;/strong&gt; : &lt;br&gt;
&lt;strong&gt;Input:&lt;/strong&gt; '([{}])'&lt;br&gt;
&lt;strong&gt;Output:&lt;/strong&gt; 'Yes'&lt;/p&gt;

&lt;p&gt;Although, you have seen many solutions to this problem. For example, using stack, using a queue, and even linked list and &lt;br&gt;
using some graph algorithms too. Here, I am sharing a very straightforward and understandable strategy to solve the balanced parenthesis problem.&lt;/p&gt;

&lt;p&gt;We can solve it by using the string's replace method.&lt;br&gt;
Let begin.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string = input()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;First, we will take the input string contains a series of parentheses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; n=-1
&amp;gt; while len(s)!=n:
&amp;gt;    n=len(s)
&amp;gt;    s=s.replace('()','')
&amp;gt;    s=s.replace('[]','')
&amp;gt;    s=s.replace('{}','')
&amp;gt; if len(s)==0:
&amp;gt;    print("Balanced")
&amp;gt; else:
&amp;gt;    print("Imbalanced")
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We will run the loop till length of string and n becomes equal. Inside loop, we will take string length in n so that n can store the past length. Now, we will try to replace matching brackets like [], {}, () if they are present in string with empty string. After that again, string length will be compared with past length n.&lt;/p&gt;

&lt;p&gt;This will become equal when there will be no more matching brackets. And this condition can arise in 2 cases :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When the string was balanced and finally it becomes an empty string due to constant replacement.&lt;/li&gt;
&lt;li&gt;When the string is imbalanced and there are no more brackets to be replaced.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If we get an empty string in the output, then we have got a balanced parenthesis string, else we got an imbalanced string.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hope this answer helps you in becoming a better competitive programmer. Feel free to ask any questions in the comment section and keep coding guys:)&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python - What, Why and Where?</title>
      <dc:creator>Anshika Bhatnagar</dc:creator>
      <pubDate>Sun, 17 May 2020 17:41:42 +0000</pubDate>
      <link>https://dev.to/bhatnagaranshika02/quick-guide-to-python-38l6</link>
      <guid>https://dev.to/bhatnagaranshika02/quick-guide-to-python-38l6</guid>
      <description>&lt;h2&gt;
  
  
  What?
&lt;/h2&gt;

&lt;p&gt;Python is a pure object oriented, dynamic, interpreted, easy to use language. Let's understand each of the terms one by one.&lt;/p&gt;

&lt;p&gt;Although, python is known as pure object oriented language, it can work as functional oriented as well. In object oriented, it focuses on objects and classes rather then functions. Object oriented programming(OOP) is a bottom up approach. &lt;/p&gt;

&lt;p&gt;When we say dynamic, it simply relate with the word 'run time'. Unlike C and C++ , you don't need to declare variables before using it. Everything can be handled during run time. No need to reserve memory, python can allocate memory at the run time only. &lt;/p&gt;

&lt;p&gt;Now its an interpreted language, just for now we need to remember that there are two things:- &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compiler&lt;/li&gt;
&lt;li&gt;Interpreter.
Interpreter reads your code line by line and if any error occurs at any line, it will display it and when you will fix that error,than only it will move forward.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And the last point is 'easy to use'. So when you will start learning python, you will automatically understand this thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Python is very easy to use because of its dynamic nature and simple syntax.&lt;/li&gt;
&lt;li&gt;Python uses white space or indentation.&lt;/li&gt;
&lt;li&gt;Python has many built-in library files which makes it powerful.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where?
&lt;/h2&gt;

&lt;p&gt;Python can be used in almost every field like:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Web development.&lt;/li&gt;
&lt;li&gt;Software development.&lt;/li&gt;
&lt;li&gt;Game development.&lt;/li&gt;
&lt;li&gt;Data science.&lt;/li&gt;
&lt;li&gt;Artificial Intelligence.
And many more..&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Writing your first python program:-&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;gt; Print('Hello World')
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In python , you can use Print() to display anything on screen. No declaration needed as it is dynamic language. That is why, it is said that python is very easy to use.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting started with Flask</title>
      <dc:creator>Anshika Bhatnagar</dc:creator>
      <pubDate>Thu, 07 May 2020 08:05:57 +0000</pubDate>
      <link>https://dev.to/bhatnagaranshika02/getting-started-with-flask-36c</link>
      <guid>https://dev.to/bhatnagaranshika02/getting-started-with-flask-36c</guid>
      <description>&lt;p&gt;Flask is a web development framework of python. It works very smoothly for small scale development. Flask is very easy to use and meanwhile, you can develop simple, interactive, and multi-page applications with the help of flask.&lt;/p&gt;

&lt;p&gt;Let's first look at how we can install flask.&lt;/p&gt;

&lt;p&gt;First, we need to create a virtual environment. &lt;strong&gt;virtualenv&lt;/strong&gt; is a virtual Python environment builder. It helps a user to create multiple Python environments side-by-side. Thereby, it can avoid compatibility issues between the different versions of the libraries.&lt;/p&gt;

&lt;p&gt;Step1: Install &lt;strong&gt;virtualenv&lt;/strong&gt; by the following command:-&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  pip install virtualenv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Step2: Create a folder of any name say, MyFirst.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  &amp;gt; mkdir MyFirst
                  &amp;gt; cd MyFirst
                  &amp;gt; virtualenv venv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Step3: Now activate the virtualenv by the following command:-&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  &amp;gt; venv\scripts\activate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Step4: Now install Flask in this environment:-&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  &amp;gt; pip install flask
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Once, flask gets install on your laptop, you can get started with your first flask application.&lt;/p&gt;

&lt;p&gt;Step1:- Inside the folder, create a python file say main.py.&lt;/p&gt;

&lt;p&gt;Step2:- Now let's go with our first flask app.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       main.py

     &amp;gt; from flask import Flask
     &amp;gt; app = Flask(__name__)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So, in line1, we are importing Flask module from flask library and in Line2 we are creating an object of Flask so that we can use its methods in our application easily. The '&lt;strong&gt;name&lt;/strong&gt;'  is namespace in python. To know more about namespace,&lt;a href="https://www.google.com/amp/s/www.geeksforgeeks.org/namespaces-and-scope-in-python/amp/"&gt; click here&lt;/a&gt;. If we importing something from outside , __ name __ &lt;br&gt;
otherwise, 'main' will get stored in __ name __.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     &amp;gt; @app.route('/home')
     &amp;gt; def home():
          return "&amp;lt;h4&amp;gt;This is Home&amp;lt;/h4&amp;gt;"
     &amp;gt; app.run(debug=True)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In line1, we created a route statement by using a decorator. To know what decorator is,&lt;a href="https://www.google.com/amp/s/www.geeksforgeeks.org/decorators-in-python/amp/"&gt; click here to know more&lt;/a&gt;. Python allows us to create a decorator using a simple @ symbol. We create separate routes for every method. The '/home' indicates that when the user will write '/home' in the link, this method should get called.&lt;br&gt;
In line2, we created a method that returns a simple text, when it gets called.&lt;/p&gt;

&lt;p&gt;Now, what if we want to develop the proper HTML page with some interactive navigation bar, footer and many more. In that case, the return statement will not work for a larger code. So here we can use 'render_template'.&lt;/p&gt;

&lt;p&gt;Step1:- Create two folders 'templates' and 'static' inside &lt;strong&gt;MyFirst&lt;/strong&gt; folder. Inside the templates folder, we can create our HTML document and inside the static folder, we can create our CSS and javascript files.&lt;/p&gt;

&lt;p&gt;Step2:- Create a HTML document say,index.html.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      index.html
      &amp;lt;html&amp;gt;
        &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
          &amp;lt;body&amp;gt;
           &amp;lt;h4&amp;gt; This is Home page&amp;lt;/h4&amp;gt;
          &amp;lt;/body&amp;gt;
      &amp;lt;/html&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now in main.py:-&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        main.py
      &amp;gt; from flask import Flask,render_template
      &amp;gt; app = Flask(__name__)
      &amp;gt; @app.route('/home')
      &amp;gt; def home():
            return render_template('templates/index.html')
      &amp;gt; app.run(debug=True)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, look at the last line.&lt;br&gt;
Here to run our application we need to include &lt;strong&gt;object_name.run(debug=True)&lt;/strong&gt; . In our case our object is app. Passing &lt;strong&gt;Debug=True&lt;/strong&gt; will allow us to modify our app again and again.&lt;br&gt;
So, guys, this was all about a simple and small application using Flask. &lt;/p&gt;

&lt;p&gt;For more projects using flask, you can visit my GitHub profile.&lt;br&gt;
&lt;a href="https://github.com/bhatnagaranshika02"&gt;https://github.com/bhatnagaranshika02&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>flask</category>
      <category>python</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How i got the GitHub Student Developer Pack.</title>
      <dc:creator>Anshika Bhatnagar</dc:creator>
      <pubDate>Tue, 05 May 2020 15:26:46 +0000</pubDate>
      <link>https://dev.to/bhatnagaranshika02/how-i-got-the-github-student-developer-pack-hji</link>
      <guid>https://dev.to/bhatnagaranshika02/how-i-got-the-github-student-developer-pack-hji</guid>
      <description>&lt;p&gt;They created the GitHub Student Developer Pack with some of their partners and friends: to give students free access to the best developer tools in one place so they can learn by doing.&lt;/p&gt;

&lt;p&gt;One fine day, I was checking out the daily updates at LinkedIn. Suddenly I came across a post by one of my friends that GitHub is providing Student Developer pack to some of the students.&lt;/p&gt;

&lt;p&gt;At first, Honestly, I was not aware of it but then I started researching it. And then I came to know that Github is providing a Student developer pack in which they will provide free subscription and access to various great platforms so that we can learn better by hands-on experience.&lt;br&gt;
There were many things on the list and hence I decided to apply and did so.&lt;/p&gt;

&lt;p&gt;After some days, I got a mail from Github and BOO-OO-OOM they gifted me the Student Developer Pack.&lt;br&gt;
I was very excited to see what I got. So, here is the list:- &lt;a href="https://education.github.com/pack"&gt;https://education.github.com/pack&lt;/a&gt;.&lt;br&gt;
If they are still accepting the applications, just go for it.&lt;/p&gt;

&lt;p&gt;The most interesting thing for me is Free GitHub Pro while I am a student.&lt;br&gt;
So, if you also wanna gain this pack just apply for it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9s1F2B6o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gnzjwm5o8tcvp2lbtc77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9s1F2B6o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gnzjwm5o8tcvp2lbtc77.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>studentdeveloperpack</category>
      <category>python</category>
    </item>
  </channel>
</rss>
