<?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: AP</title>
    <description>The latest articles on DEV Community by AP (@arjunpraveen2008).</description>
    <link>https://dev.to/arjunpraveen2008</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%2F770651%2F8efaf1f6-9e81-4347-956e-44668d579756.png</url>
      <title>DEV Community: AP</title>
      <link>https://dev.to/arjunpraveen2008</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arjunpraveen2008"/>
    <language>en</language>
    <item>
      <title>Load an interactive 3d model onto your web app- Lazy Tutorials #1</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Thu, 20 Apr 2023 09:45:48 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/load-an-interactive-3d-model-onto-your-web-app-lazy-tutorials-1-16ph</link>
      <guid>https://dev.to/arjunpraveen2008/load-an-interactive-3d-model-onto-your-web-app-lazy-tutorials-1-16ph</guid>
      <description>&lt;h2&gt;
  
  
  Introduction (completely optional to read, If you're too lazy 🥱)
&lt;/h2&gt;

&lt;p&gt;Hi there! Long time no see! I must confess, I haven't felt the urge to write anything here for a while now. Maybe it's because I've been caught up with my own projects, or perhaps I've just been feeling a bit too lazy to put pen to paper. But actually, that's what sparked this idea. I've realized that reading through a lengthy article from start to finish can be a bit of a drag, and that's why people tend to prefer watching videos instead. I get it - I've been there myself many times. It got me thinking though, is there a way we could cut through all the fluff and get straight to the heart of the matter? As programmers, we often face challenges and constraints that we need to solve, and I think we could benefit from a more direct approach. No more wading through junky articles and endless videos - let's get to the point and solve those problems! 💪&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;As this becomes the first article to be written in the Lazy tutorial series, I hope this lets you find what you're looking for, &lt;strong&gt;faster&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;I'm not gonna explain all the code I'm gonna write here (75% of it is self explanatory - besides, I'm writing this for those who don't have the interest in wasting their valuable time learning all that they do, but rather in finding a quick solution for the same 🙂).&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Loading the 3d model:
&lt;/h3&gt;

&lt;p&gt;Here I've used the &lt;code&gt;&amp;lt;model-viewer&amp;gt;&lt;/code&gt; API for loading and rendering the 3d model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://ajax.googleapis.com/ajax/libs/model-viewer/3.0.1/model-viewer.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Use it like any other HTML element --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;model-viewer&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Write a cool description about your 3d model."&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"your_models_file_name_or_path.glb"&lt;/span&gt; &lt;span class="na"&gt;ar&lt;/span&gt; &lt;span class="na"&gt;environment-image=&lt;/span&gt;&lt;span class="s"&gt;"the_background_hdr_optional.hdr"&lt;/span&gt; &lt;span class="na"&gt;poster=&lt;/span&gt;&lt;span class="s"&gt;"poster_to_be_displayed_before_loading_model.webp"&lt;/span&gt; &lt;span class="na"&gt;shadow-intensity=&lt;/span&gt;&lt;span class="s"&gt;"1"&lt;/span&gt; &lt;span class="na"&gt;camera-controls&lt;/span&gt; &lt;span class="na"&gt;touch-action=&lt;/span&gt;&lt;span class="s"&gt;"pan-y"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/model-viewer&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Obviously, it's important to change the source of the 3d model (src), the environment image file path (hdr, optional), and the poster (again, optional) to load the 3d model on your web page.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Here's the link to the API's docs just in case you wanna go further: &lt;a href="https://modelviewer.dev/"&gt;ModelViewer.dev&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;That's it! This tip should have helped you load your own 3d model into your web page/web app... If so, do gimme your feedback in the comment box - If not, feel free to add any suggestions in the same spot - Happy Coding! 🥱💥&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bJo3APNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfjyog4405k3ei7bw3x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bJo3APNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfjyog4405k3ei7bw3x2.png" alt="An awesome meme." width="723" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Phish anyone, anytime - all you need is Python!</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Sun, 23 Oct 2022 16:46:57 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/phish-anyone-anytime-all-you-need-is-python-55d2</link>
      <guid>https://dev.to/arjunpraveen2008/phish-anyone-anytime-all-you-need-is-python-55d2</guid>
      <description>&lt;p&gt;Howdy! It's been a while since I've posted any blogs in dev.to - but I bet that's balanced with this single post; it's interesting, trust me!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Warning&lt;/em&gt;: This article is meant for fun and educational purposes only. Using the tools mentioned in this page with ill-intention is illegal and can cause great losses. Plus, I'm not responsible for any such losses or harms. &lt;strong&gt;FOLLOW AT YOUR OWN RISK&lt;/strong&gt; ⚠️.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jDAVhqWe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68jxcpebstgpvzc35avv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jDAVhqWe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68jxcpebstgpvzc35avv.jpg" alt="phishing meme 1" width="600" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;PS: A great thanks to &lt;a href="https://github.com/KasRoudra/PyPhisher"&gt;PyPhisher&lt;/a&gt; for making this tutorial possible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As of a warm up blog, I'm not gonna explain what phishing is or how it works. (It's assumed that you know what it is :-)) Instead, I'm gonna go straight into the &lt;em&gt;"hacking"&lt;/em&gt; area, where you can have some &lt;em&gt;real&lt;/em&gt; fun. Again, I should remind you not to do this to others except your friends or maybe even your family members. &lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;All you need to setup this &lt;em&gt;Hacking&lt;/em&gt; recipe, is a good PC to work on and have Python installed. Additionally, you will require a git repository to be cloned to your PC. Just run the below commands in a Linux terminal to move on to the next part of this tutorial.&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: It's really important that you use a Linux terminal. If you're on windows, then try installing WSL (Windows Subsystem for Linux) and then running the command in that terminal.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/KasRoudra/PyPhisher
&lt;span class="nb"&gt;cd &lt;/span&gt;PyPhisher
pip3 &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; files/requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you have to install..... Wait! That's it! You have successfully configured all the necessary stuff for this tutorial. The only thing that's left for us is to run the code. Well, let's do that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 pyphisher.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, for the first time, running this command will take several minutes for the installation to be complete. After that, you will be prompted to enter some information (press Enter to set the defaults). This is only for the first time, and anytime you use it afterwards, there will be no more installations or such configs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5q__HwlM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e336fy59igibm6j7lj6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5q__HwlM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e336fy59igibm6j7lj6c.png" alt="screenshot 1" width="800" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're getting a similar output, then just type in which social media website you want to be counterfeited. In a nutshell, you are again prompted to type in what kind of login page you want, and some extra (optional) features of the same.&lt;/p&gt;

&lt;p&gt;After doing all these stuff, you will finally get the &lt;em&gt;magic&lt;/em&gt; link! Now, it's yours to keep - forever. Use the link wisely, perhaps redirecting someone from your website to this link, or maybe even scamming them with an email containing this link can help you get their login credentials. Now go on, try doing it on yourself and see if you can trick others as well. &lt;strong&gt;Happy Phishing!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope this tutorial lets you know more about phishing, and how &lt;em&gt;scaringly&lt;/em&gt; easy it is to phish someone using simple tools and self-explanatory code. In essence, Python is indeed a magic wand that lets you create wonders, with minimal utilities. Thank you for reading this blogpost and I will see you on another &lt;em&gt;cool&lt;/em&gt; tutorial. Till then, &lt;strong&gt;Au revoir!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uzpimZE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9ck5svjmprdltxh5nc6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uzpimZE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9ck5svjmprdltxh5nc6.jpg" alt="phishing meme 2" width="500" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Top 3 resources to get assets for your website...</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Tue, 25 Jan 2022 08:27:37 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/top-3-resources-to-get-assets-for-your-website-ojf</link>
      <guid>https://dev.to/arjunpraveen2008/top-3-resources-to-get-assets-for-your-website-ojf</guid>
      <description>&lt;p&gt;Hello, world! In this article, I'm gonna walk you through a few useful resources from where you can get assets for your website.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---EMW-QXi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hchtqfmr40964xc7tf0b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---EMW-QXi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hchtqfmr40964xc7tf0b.png" alt="An illustration about web dev." width="259" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This article does not intend to make use of unnecessary affiliates, advertisements or any kind of misleading content. These are based on my personal interest.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;#1 Unsplash&lt;/h2&gt;

&lt;p&gt;
Unsplash is a great asset library for high-resolution images and illustrations. They provide us with free images that can  be used for both commercial and non-commercial purposes, without any kind of attribution.
&lt;/p&gt;

&lt;p&gt;Visit Unsplash at &lt;a href="https://unsplash.com/"&gt;https://unsplash.com/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3aHD8zGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1q3o2jhrwdza1moao16b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3aHD8zGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1q3o2jhrwdza1moao16b.png" alt="Unsplash logo" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;#2 Icons8&lt;/h2&gt;

&lt;p&gt;
Icons8 is a plethora of web assets that you can use for free for your web project, though it might require some kind of attribution.
&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Now, when I say web assets, I mean it all - yeah, Icons8 does contain a wide variety of icons, images, illustrations, design softwares, clipart, music, image enhancement tools, PBR textures, face generators, audio editors and many more.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
While I personally use Google's &lt;a href="https://font.google.com/icons"&gt;Material Icons&lt;/a&gt; for icons on web apps, I use Icons8's icons as &lt;em&gt;favicons&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Visit Icons8 at &lt;a href="https://icons8.com/"&gt;https://icons8.com/&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3khZsGtb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5oaklam9mep61dehltr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3khZsGtb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5oaklam9mep61dehltr.png" alt="Icons8 logo" width="348" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;#3 FreeSound&lt;/h2&gt;

&lt;p&gt;Since FreeSound is an audio asset library, it is not specific to web only, but any branch of computer science that deals with sound (Remember: By the term audio assets, I mean sound effects and not music). I frequently use this resource for searching sound effects for video editing, game dev, etc. While there are millions of resources out there that can provide you with free music, I couldn't find a better resource for sound effects than FreeSound.&lt;/p&gt;

&lt;p&gt;Visit FreeSound at &lt;a href="https://freesound.org/"&gt;https://freesound.org/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0mBjIpMZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5kxljxzyz51tlvuxkgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0mBjIpMZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5kxljxzyz51tlvuxkgv.png" alt="FreeSound logo" width="541" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;And that's it! I went over a few amazing asset libraries that I personally use during web dev, which might help you too. Thanks for reading - see you next time!&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Develop a hangman game in Python in just 5 minutes</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Thu, 16 Dec 2021 06:14:30 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/develop-a-hangman-game-in-python-in-just-5-minutes-4c3n</link>
      <guid>https://dev.to/arjunpraveen2008/develop-a-hangman-game-in-python-in-just-5-minutes-4c3n</guid>
      <description>&lt;p&gt;Hello, world! In this post, I will walk you through a simple &lt;em&gt;hangman&lt;/em&gt; game in Python. This post already assumes that you have prior programming experience in Python. If not, a great way to get started is via &lt;a href="https://www.w3schools.com/python/default.asp"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Now, this is isn't a GUI based game - just a terminal based I/O game that can improve your &lt;em&gt;pythonic&lt;/em&gt; knowledge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What's a hangman game?
&lt;/h2&gt;

&lt;p&gt;Hangman is a paper and pencil guessing game for two or more players. One player thinks of a word, phrase, or sentence, and the other tries to guess it by suggesting letters within a certain number of guesses. (Source: &lt;a href="https://en.wikipedia.org/wiki/Hangman_(game)"&gt;Wikipedia&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what's the plan?
&lt;/h2&gt;

&lt;p&gt;Now that you know what's Hangman, let me provide you with a fine pseudocode for the same:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pick a random word from a large dataset.
initialize points to 0
while True:
    set POSSIBLE_ALPHABETS = list of "abcdefghijklmnopqrstuvwxyz"
    set RANDOM_ALPHABETS = pick 3 random alphabets from POSSIBLE_ALPHABETS
    for ALPHABET in RANDOM_ALPHABETS:
        replace ALPHABET from the random word with a "_"

    print the random word (after replacement of alphabets)
    take input from the user as ANSWER

    if ANSWER is equal to the random word:
        #Hurray!
        increment points by 1
    else:
        #Alas!
        print the total points
        break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will be the infrastructure of our game - feel free to change or modify this pseudocode according to your means.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pip requirements
&lt;/h2&gt;

&lt;p&gt;Install the following packages: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;colorama (optional)&lt;/li&gt;
&lt;li&gt;nltk&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Alright!&lt;/strong&gt; With a nice and firm pseudocode, let's get into the actual code:&lt;/p&gt;

&lt;p&gt;First of all, we want to import all modules.&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="nn"&gt;random&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;colorama&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;nltk.corpus&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;brown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: Here I'm using brown dataset from nltk.corpus which is a large collection of words - alternatively, you can replace the usage of Brown with your own dataset.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, we want to get all the words of the Brown dataset and put it in a variable:&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;word_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;brown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: If you are using your own dataset, try this: &lt;code&gt;word_list = ['apple', 'computer', 'banana', 'soap', 'snake', ...]&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, let's initialize a &lt;em&gt;points&lt;/em&gt; variable and set its initial value to zero &lt;code&gt;0&lt;/code&gt;.&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;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I came up with an idea of using "Colorama" which can provide you with colored output on the terminal window. It is optional, and I did this to make the output a bit nice.&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;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;autoreset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we need to loop our game till the player loses (so that we can increment the points), let's wrap the upcoming lines of code with an infinite loop:&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;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;#rest of the code goes here.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I don't why I did this, but I re-initialized the word_list with another variable &lt;code&gt;words&lt;/code&gt;:&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;words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;word_list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, this is the time we need a list of all possible alphabets (from &lt;strong&gt;A&lt;/strong&gt; to &lt;strong&gt;Z&lt;/strong&gt;):&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;possible_alphabets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"abcdefghijklmnopqrstuvwxyz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;old_word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: I also added a variable &lt;code&gt;old_word&lt;/code&gt; to choose a random word from &lt;code&gt;word_list&lt;/code&gt; - I named it like that, just so that I can differentiate it from the word after that it has been modified.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, add these lines of code to your existing Python code:&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;alphabets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;#initialize alphabets list
&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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;alphabets&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;possible_alphabets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I did this so that I have an &lt;code&gt;alphabets&lt;/code&gt; list, and that I append 3 random letters to the &lt;code&gt;alphabets&lt;/code&gt; list from the &lt;code&gt;possible_alphabets&lt;/code&gt; list (as per the pseudocode we designed before).&lt;/p&gt;

&lt;p&gt;Now that we have that, let's replace all these random alphabets from the &lt;code&gt;old_word&lt;/code&gt; with an underscore, so that we could make our guessable string (Eg: "developer" as "de_e_ope_")&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;for&lt;/span&gt; &lt;span class="n"&gt;alphabet&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alphabets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alphabet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&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;Cool!&lt;/strong&gt; Everything seems to be right till now; let's start getting the user input.&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;if&lt;/span&gt; &lt;span class="s"&gt;"_"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;#additional error checking
&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;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#printing the word with underscore
&lt;/span&gt;    &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'word: '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, as a conslusion, add these lines of code:&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;if&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&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;'That&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s"&gt;s correct! Total points: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CYAN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;points&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;else&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;'Sorry, but you lost. (The actual word was &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GREEN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WHITE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;'&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;'------GAME OVER------'&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;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Total points: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CYAN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;break&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We finally checked whether the user input was the same as of the original word, and if it was, we incremented the points by 1. If it wasn't, we then broke out of the loop, saying that the game was over.&lt;/p&gt;

&lt;p&gt;In a nutshell (for lazy developers):&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="nn"&gt;random&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;colorama&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;nltk.corpus&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;brown&lt;/span&gt;

&lt;span class="n"&gt;word_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;brown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;#word_set = set(word_list)
&lt;/span&gt;
&lt;span class="c1"&gt;#print(random.choice(word_list))
&lt;/span&gt;
&lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;autoreset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;word_list&lt;/span&gt;

    &lt;span class="n"&gt;possible_alphabets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"abcdefghijklmnopqrstuvwxyz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;old_word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;alphabets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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;alphabets&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;possible_alphabets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;alphabet&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alphabets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alphabet&lt;/span&gt;&lt;span class="p"&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;if&lt;/span&gt; &lt;span class="s"&gt;"_"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;word&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;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'word: '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&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;'That&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s"&gt;s correct! Total points: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CYAN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;points&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;else&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;'Sorry, but you lost. (The actual word was &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GREEN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;old_word&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WHITE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;'&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;'------GAME OVER------'&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;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Total points: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;colorama&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CYAN&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;break&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Run the code, and see what you get!&lt;/p&gt;

&lt;p&gt;This was just a beginning; here's an idea for you to make our project more interesting: why not create a GUI for the same?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Having any doubts or queries regarding the topic? Feel free to mention it in the comments below and I will try my best to respond to you!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Python is so amazing that it is meant for any branches of computer science. It's way of implementing algorithms in easier syntaxes makes it unchallenging to execute any plan.&lt;/p&gt;

&lt;p&gt;If you liked the project, give it a thumbs up 👍, so that I can make cooler projects like this - till then, see you next time!&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Create a simple web app with Python and flask in 10 minutes</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Wed, 15 Dec 2021 07:11:30 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/create-a-simple-web-app-with-python-and-flask-in-5-minutes-22kd</link>
      <guid>https://dev.to/arjunpraveen2008/create-a-simple-web-app-with-python-and-flask-in-5-minutes-22kd</guid>
      <description>&lt;p&gt;Hello, world! Today, I would be creating a simple python web application with Flask, a microframework for creating full-fledged web applications. I will be covering this topic with Flask since it is an intermediate + beginner tutorial, where anyone with no prior experience can follow along.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Before we move on...
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes that you have Python installed in your Mac or PC (&lt;em&gt;required&lt;/em&gt;) and that you have done &lt;a href="https://www.w3schools.com/python/python_classes.asp" rel="noopener noreferrer"&gt;object-oriented programming&lt;/a&gt; in Python before. These prerequisites (except the former one) are &lt;em&gt;recommended but not required&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Flask?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Flask is a micro web framework written in Python.&lt;/li&gt;
&lt;li&gt; It is classified as a microframework because it does not require particular tools or libraries. &lt;/li&gt;
&lt;li&gt;It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;(Source: &lt;a href="https://en.wikipedia.org/wiki/Flask_(web_framework)" rel="noopener noreferrer"&gt;wikipedia&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fwlssytoezalpr9q7f5k2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fwlssytoezalpr9q7f5k2.png" alt="Flask logo banner"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;It is always recommended to create a new directory as your project folder, and that you have activated a &lt;a href="https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/" rel="noopener noreferrer"&gt;virtual environment&lt;/a&gt; (optional).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Via Pip&lt;/strong&gt; - &lt;code&gt;pip install Flask&lt;/code&gt; (See &lt;a href="https://pypi.org/project/Flask/" rel="noopener noreferrer"&gt;this&lt;/a&gt; for specifications.)&lt;br&gt;
&lt;strong&gt;Via Conda&lt;/strong&gt; - &lt;code&gt;conda install -c anaconda flask&lt;/code&gt; (See &lt;a href="https://anaconda.org/anaconda/flask" rel="noopener noreferrer"&gt;this&lt;/a&gt; for specifications.)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To check whether Flask has been successfully installed on your Mac or PC, type in &lt;code&gt;flask --version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If getting an error, try using &lt;code&gt;python -m flask --version&lt;/code&gt; or &lt;code&gt;python3 -m flask --version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If none of the above commands work for you, you can directly run your app instead of running it from the terminal or command prompt (more on that later). &lt;/p&gt;

&lt;p&gt;Hmm...Seems like a handful of configurations, but these are only necessary for the first time when you install flask. (Not meant for people using &lt;a href="https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/" rel="noopener noreferrer"&gt;virtual environment&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fup845oz1x8n0fz57n0xd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fup845oz1x8n0fz57n0xd.png" alt="Installation of Flask"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Our first Flask app
&lt;/h2&gt;

&lt;p&gt;Now, it's time to create our flask app; create a new file in the project directory and name it "app.py". This file contains the back-end code for our application. &lt;/p&gt;

&lt;p&gt;As a starter template, type in this code:&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="c1"&gt;# app.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&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="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, world!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Omittable
&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&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="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code lines explained (for newbies)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;from flask import Flask&lt;/code&gt; - seems a bit strange that you have to import Flask, again from flask? What is happening here is that you are importing a class named &lt;strong&gt;"Flask"&lt;/strong&gt; (capitalized) from the actual module that we installed before, named &lt;strong&gt;flask&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app = Flask(__name__)&lt;/code&gt; - Here, we are instantiating the Flask class and declaring it in a variable named "app"; this app variable is the main structure of our app that can handle routes, run the app, debug it, etc.&lt;/p&gt;

&lt;p&gt;The extra parameter that we give to the Flask class (__&lt;strong&gt;&lt;em&gt;name&lt;/em&gt;&lt;/strong&gt;__) just checks whether we are in an application package, or just an individual module. (Learn more &lt;a href="https://blog.miguelgrinberg.com/post/why-do-we-pass-name-to-the-flask-class" rel="noopener noreferrer"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@app.route('/')&lt;/code&gt; - Now, this is a Python &lt;a href="https://www.geeksforgeeks.org/decorators-in-python/" rel="noopener noreferrer"&gt;decorator&lt;/a&gt;.&lt;br&gt;
Here, we are defining a route (If you are already familiar with web programming and have used any web frameworks for this purpose, you might be familiar with routes as well).&lt;br&gt;
A route is a simple way of telling the server to create a specific path in the app, so that the users will be able to visit it via a web browser.&lt;/p&gt;

&lt;p&gt;For the purpose of demonstration, consider these routes as a pathway where users can walk through.&lt;/p&gt;

&lt;p&gt;A web app can contain multiple routes, and each route is prefixed with a forward slash "/". If you visit a URL, most of the times the default route will be "/" (For example, " dev.to/", " google.com/"). Other examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/search&lt;/li&gt;
&lt;li&gt;/login&lt;/li&gt;
&lt;li&gt;/signup&lt;/li&gt;
&lt;li&gt;/posts/abcd (This is a nested route, having a route inside another route)&lt;/li&gt;
&lt;li&gt;/greet?name=John+Smith (A route with a URL parameter "name" and its value set to "John Smith")&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;def index():    return "Hello, world!"&lt;/code&gt; - This line of code defines a function named &lt;strong&gt;index&lt;/strong&gt; and the above decorator installs this function to the app instance of Flask class, then this function returns "Hello, world!" which would be displayed in the user's browser as an HttpResponse.&lt;/p&gt;

&lt;p&gt;Next lines of code can be omitted if the &lt;code&gt;flask --version&lt;/code&gt; commands worked in your terminal window. These lines just run the app, only if the user is actually running the "app.py" file and not when importing the file from somewhere else.&lt;/p&gt;
&lt;h2&gt;
  
  
  Running the app
&lt;/h2&gt;

&lt;p&gt;To run our app, just type in &lt;code&gt;flask run&lt;/code&gt; to run it via the terminal window or command prompt (in Windows), or just run the python file to run it directly (&lt;code&gt;python app.py&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hurray!&lt;/strong&gt; Our app has been run, now you can visit &lt;a href="https://dev.tolocalhost:5000"&gt;localhost:5000&lt;/a&gt; in your favorite browser to see our app up and running!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Try changing the value of "Hello, world!" in the 8th line to see the result being reflected on the browser.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Some HTML, perhaps?
&lt;/h2&gt;

&lt;p&gt;Ok, now it's time to write some HTML and make our app look a bit nicer. Our app only returns "Hello, world!" since, which no one would like to stay with. You can also add inline HTML to the string provided (For example, &lt;code&gt;return "&amp;lt;h1&amp;gt;Hello!&amp;lt;/h1&amp;gt;"&lt;/code&gt;), but that isn't the way to do it. The following steps show you how to add an html file to the server and display it to the user to make it an actual web app.&lt;/p&gt;

&lt;p&gt;Create a new folder named &lt;em&gt;templates&lt;/em&gt; in the project directory; inside of it, create a new file named "index.html". Then, inside "index.html":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!doctype html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
        &lt;span class="na"&gt;integrity=&lt;/span&gt;&lt;span class="s"&gt;"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"&lt;/span&gt; &lt;span class="na"&gt;crossorigin=&lt;/span&gt;&lt;span class="s"&gt;"anonymous"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Hello, world!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello, world&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"&lt;/span&gt;
        &lt;span class="na"&gt;integrity=&lt;/span&gt;&lt;span class="s"&gt;"sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"&lt;/span&gt;
        &lt;span class="na"&gt;crossorigin=&lt;/span&gt;&lt;span class="s"&gt;"anonymous"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: I've added additional Bootstrap CDN to style our web app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, in our Python code, change the &lt;code&gt;from flask import Flask&lt;/code&gt; to something 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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is done to make sure that we import a function named 'render_template' which returns an &lt;strong&gt;HTML template&lt;/strong&gt; as an HttpResponse. &lt;/p&gt;

&lt;p&gt;Then, change the &lt;code&gt;return "Hello, world!"&lt;/code&gt; to something 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;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&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 above is self-explanatory. It just returns &lt;em&gt;index.html&lt;/em&gt; whenever someone visits the "/" route.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: if you are using the command &lt;code&gt;flask run&lt;/code&gt;, you may have to stop the server (Ctr + C) and rerun it to see the changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Challenge: More routes
&lt;/h2&gt;

&lt;p&gt;Now, our app is just serving one route, but we can add more routes to make it more sophisticated:&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="c1"&gt;# app.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&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="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/greet&lt;/span&gt;&lt;span class="sh"&gt;'&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;greet&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;greet.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Omittable
&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&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="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This creates another route named "greet", and returns another HTML file "greet.html". Try creating the "greet.html" file in the templates folder and visiting &lt;a href="https://dev.tolocalhost:5000/greet"&gt;localhost:5000/greet&lt;/a&gt; to see the newly created file!&lt;/p&gt;

&lt;h2&gt;
  
  
  Serving static?
&lt;/h2&gt;

&lt;p&gt;CSS, JS and Assets (like images, video clips, SVG, etc.) files never change dynamically - so these can be called as static files. Create a new folder in the project directory named "static", and inside of it, you can place all your static files. One more tweak in the "app.py" file, and you are ready to go.&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;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url_for&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When linking static files, consider adding this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{url_for('static', filename='style.css')}}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
...
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"{{url_for('static', filename='script.js')}}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;{{}}&lt;/code&gt; are Jinja syntaxes. Now, Jinja is a templating language used by Flask to serve dynamic pages. &lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic pages?
&lt;/h2&gt;

&lt;p&gt;Pages that can change its content dynamically according to the data entered by the user are called dynamic pages. These can be easily created by passing in the values (to be dynamically displayed) in the &lt;code&gt;render_template&lt;/code&gt; function, 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;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Brian&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be called from the "index.html" like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello, {{name}}!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congrats, you've created and run your first Flask app!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are having any queries or suggestions related to this topic, feel free to mention it in the comments below, and I will try my best to reply for the same!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Flask is an amazing platform to get started with web programming. Possibilities are endless with Flask, and you can do a lot more than the details listed in this article.&lt;/p&gt;

&lt;p&gt;There are a lot of tutorials on the internet that can provide you with the finest materials for creating more advanced projects, and I too soon will be posting a tutorial for creating advanced apps in Flask; this was just a beginning. I will also post an article on how you can host your web app on Heroku for free. Till then, bye 🖐!&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>flask</category>
      <category>programming</category>
    </item>
    <item>
      <title>Top 5 UI trends of 2021 every developer should know</title>
      <dc:creator>AP</dc:creator>
      <pubDate>Tue, 14 Dec 2021 05:40:21 +0000</pubDate>
      <link>https://dev.to/arjunpraveen2008/top-5-ui-trends-of-2021-13bh</link>
      <guid>https://dev.to/arjunpraveen2008/top-5-ui-trends-of-2021-13bh</guid>
      <description>&lt;p&gt;Hello, world! Often we are developing a full-stack web application, we usually start from the backend, focusing on the main bugs and issues of it. Then we move onto the front-end stuff; perhaps a taste of React would do.&lt;/p&gt;

&lt;p&gt;But ever thought about how other web apps look much nicer than yours? Well, my tip is to find inspirations like that. But remember that the UI plays a major role in making a good impression on your web apps' users - so it should be as good as any web apps of 2021, and soon as in 2022.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hzvFjsu9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w59hjaef05xn1ca9941e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hzvFjsu9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w59hjaef05xn1ca9941e.png" alt="web trends of 2021 - an illustration" width="800" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, you need inspiration? - Here you go! I've gathered a few trends of 2021 to include in your web app to make it look cooler.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Usage of box-shadow in CSS (Neumorphism)
&lt;/h2&gt;

&lt;p&gt;Shadows became an important aspect of web UI in 2020. they make the web components look like they are floating, which makes it more interactive with the user.&lt;/p&gt;

&lt;p&gt;But &lt;strong&gt;NEVER&lt;/strong&gt; use shadows in a contrast way, having sharp edges and black fill. This will have an adverse effect on the user, and I, as any user, hates the way it looks like. Here is a picture depicting what I mean: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hriXjB2E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u77maeyagq7ufv9gm848.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hriXjB2E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u77maeyagq7ufv9gm848.png" alt="An ugly box shadow (according to my perspective)" width="400" height="159"&gt;&lt;/a&gt;&lt;br&gt;
Instead, I would suggest something like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dyv1t9CP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ton3lbssl0yqhzy8elmv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dyv1t9CP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ton3lbssl0yqhzy8elmv.jpg" alt="A better way to apply box shadows to html elements" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: You don't have to do this yourself! There are millions of apps out there that can do this for you - I would consider &lt;a href="https://shadows.brumm.af/"&gt;this&lt;/a&gt; or maybe &lt;a href="https://box-shadow.dev/"&gt;this&lt;/a&gt;, or you can even copy the values of the CSS's shadow property from other cool web apps like &lt;a href="https://programiz.com/"&gt;Programiz&lt;/a&gt;, via the developer tools in your browser.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, shadows should me smooth, attractive and hyper realistic; they are there for impressing the user and not for &lt;em&gt;scaring&lt;/em&gt; them out.&lt;/p&gt;

&lt;p&gt;Then comes these topics:&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Usage of JavaScript for animations and better user interactivity:
&lt;/h2&gt;

&lt;p&gt;Yes, it's amazing! JavaScript is one of the best ways by which you can improve user interactivity and can do a lot to increase the business productivity. It's so cool that you can use it for any kind of web designing - at least one library would be there, meant for the purpose of doing so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6JFnOl9X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjhhgab07c5dyvfveuzx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6JFnOl9X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjhhgab07c5dyvfveuzx.jpg" alt="Meme related to JavaScript" width="173" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Translucency on the web - Glassmorphism:
&lt;/h2&gt;

&lt;p&gt;Ok, now I wouldn't recommend mixing up glassmorphism with neumorphism - that would be a mess. But glassmorphism alone is a robust way to design your app, where each element is given a particular translucency with a bit of blurred background to resemble glass. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KfNzzSWn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plkg5md50afyv8l6xd77.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KfNzzSWn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plkg5md50afyv8l6xd77.jpg" alt="A meme related to glassmorphism" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Image formats - JPEG, PNG, WEBP OR SVG?
&lt;/h2&gt;

&lt;p&gt;Image formats should be chosen wisely - JPEG for photographs, PNG for icons, SVG for animations and icons, WEBP as a better alternative for both PNG and JPEG, GIF for images containing multiple frames (animated clips), and many more.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mmO9qlnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh927rfajtj0npyuvjk4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mmO9qlnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh927rfajtj0npyuvjk4.jpg" alt="A meme on image formats" width="719" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Code obfuscation
&lt;/h2&gt;

&lt;p&gt;Now, I wouldn't put this topic in &lt;em&gt;"web trends"&lt;/em&gt;, but it's worth a glance, as it can save a number of lives. &lt;/p&gt;

&lt;p&gt;Code obfuscation is a way by which you deliberately make your code look ugly with the help of an &lt;a href="https://en.wikipedia.org/wiki/Obfuscation_(software)"&gt;obfuscator&lt;/a&gt;. This is done to make sure that no one (including yourself!) steals any code from your web app's front-end via the Developer tools of the browser, so that you can easily monetize with your app and no one will be able to get the source code (unless you are building an open source software!) .&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vRJhMfOQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xwxearo1z79gwfxgmfrj.png" alt="A comic strip related to obfuscation" width="500" height="967"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In short, web is an ever-increasing plethora of wonders - do it the best way, and you too can create wonders with it. I hope the techniques and tools mentioned above played at least a minor role in your development career - Thanks for reading!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>html</category>
      <category>css</category>
    </item>
  </channel>
</rss>
