<?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: Ihtesham Haider</title>
    <description>The latest articles on DEV Community by Ihtesham Haider (@ihtesham_haider).</description>
    <link>https://dev.to/ihtesham_haider</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%2F656798%2F88525e02-cead-452c-ab5d-3f7d371e5d7d.jpeg</url>
      <title>DEV Community: Ihtesham Haider</title>
      <link>https://dev.to/ihtesham_haider</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ihtesham_haider"/>
    <language>en</language>
    <item>
      <title>Python Project: DNA Visualization (with TUTORIAL)</title>
      <dc:creator>Ihtesham Haider</dc:creator>
      <pubDate>Tue, 05 Oct 2021 17:46:11 +0000</pubDate>
      <link>https://dev.to/ihtesham_haider/python-project-dna-visualization-with-tutorial-28pg</link>
      <guid>https://dev.to/ihtesham_haider/python-project-dna-visualization-with-tutorial-28pg</guid>
      <description>&lt;p&gt;Hey, do you want to make projects that make you stand out in your career and to make your craft to the next level!. This tutorial will help to achieve what you want. &lt;/p&gt;

&lt;p&gt;Today, we're making a DNA (Deoxyribonucleic Acid) visualization which will look like this!.&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%2Ffto83a1gqb315sz0cw91.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%2Ffto83a1gqb315sz0cw91.png" alt="DNA visualization Project || Ihtesham Haider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before you jump into the project read this!&lt;br&gt;
DNA is a tiny molecule that exists in every cell of our bodies and contains the blueprint for &lt;strong&gt;how our bodies grow&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;It looks like a &lt;strong&gt;double helix&lt;/strong&gt;(a twisted ladder a like) of pairs of nucleotide molecules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;guanine &lt;/li&gt;
&lt;li&gt;cytosine &lt;/li&gt;
&lt;li&gt;adenine &lt;/li&gt;
&lt;li&gt;and thymine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this project these are shown like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Guanine = G&lt;/li&gt;
&lt;li&gt;Cytosine = C&lt;/li&gt;
&lt;li&gt;Adenine = A&lt;/li&gt;
&lt;li&gt;Thymine = T&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;This program is a simple animation of DNA&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  How this actually work!!
&lt;/h4&gt;

&lt;p&gt;This program create a scrolling animation by printing the strings from the ROWS list. The AT and CG pairs are inserted into each string with the format() string method.&lt;/p&gt;

&lt;h4&gt;
  
  
  Let's Go!
&lt;/h4&gt;

&lt;p&gt;First code then the "how" part&lt;/p&gt;

&lt;h3&gt;
  
  
  CODE / Discussion
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random
import sys
import time

PAUSE = 0.15  # Change it 0.0 and see what happen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Imported random, sys and time for the use. You can also write these in shorthand like  &lt;code&gt;import random, sys, time&lt;/code&gt; it will also work.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PAUSE&lt;/code&gt; !Try to change it 0.0 and see what happens when change it. First use 0.15 as default then change it.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# below are the rows of DNA animation

ROWS = [
    '         ##',
    '        #{}-{}#',
    '       #{}---{}#',
    '      #{}-----{}#',
    '     #{}------{}#',
    '    #{}------{}#',
    '    #{}-----{}#',
    '     #{}---{}#',
    '      #{}-{}#',
    '       ##',
    '      #{}-{}#',
    '      #{}---{}#',
    '     #{}-----{}#',
    '     #{}------{}#',
    '      #{}------{}#',
    '       #{}-----{}#',
    '        #{}---{}#',
    '         #{}-{}#',]
    #123456789 use this to measure the number of spaces
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ROWS&lt;/code&gt; contain a list and in this a all the structure of the DNA is in a string.&lt;/li&gt;
&lt;li&gt;Use this formula for better result &lt;code&gt;123456789&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The first &lt;code&gt;##&lt;/code&gt; at &lt;code&gt;9&lt;/code&gt; then going down.&lt;/li&gt;
&lt;li&gt;At the tenth number &lt;code&gt;##&lt;/code&gt; again starts but now going to right side rather left side.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    print('DNA Visualization || Ihtesham Haider')
    print('Press CTRL-C on Keyboard to quit....')
    time.sleep(2)
    rowIndex = 0

    #Main loop of the program || Started
    while True:
        #incrementing for to draw a next row:
        rowIndex = rowIndex +1
        if rowIndex == len(ROWS):
            rowIndex = 0

        # Row indexes 0 and 9 don't have nucleotides:
        if rowIndex == 0 or rowIndex ==9:
            print(ROWS[rowIndex])
            continue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you're not familiar with &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;except&lt;/code&gt;, I will explain it to you in just a minute.&lt;/li&gt;
&lt;li&gt;It is simply used for Error handling. The try block lets you test a block of code for errors.The except block lets you handle the error.&lt;/li&gt;
&lt;li&gt;while loop is the main loop which will be used for incrementing the string one after the other consecutively.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        randomSelection = random.randint(1,4)
        if randomSelection ==1:
            leftNucleotide, rightNucleotide = 'A', 'T'
        elif randomSelection ==2:
            leftNucleotide, rightNucleotide = 'T', 'A'
        elif randomSelection ==3:
            leftNucleotide, rightNucleotide = 'C', 'G'
        elif randomSelection ==4:
            leftNucleotide, rightNucleotide = 'G', 'C'

        # priting the row
        print(ROWS[rowIndex].format(leftNucleotide, rightNucleotide))
        time.sleep(PAUSE) 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;This program will randomly select  random nucleotide pairs, guanine-cytosine and adenine-thymine. &lt;/li&gt;
&lt;li&gt;For this purpose we have used &lt;code&gt;random.randit(1,4)&lt;/code&gt; 1 to 4&lt;/li&gt;
&lt;li&gt;Then we used &lt;code&gt;if elif&lt;/code&gt; conditions to check the program for us and values at the right place.&lt;/li&gt;
&lt;li&gt;After &lt;code&gt;conditions = if -elif&lt;/code&gt; we printed out the row and then a time module is used which we have imported and used pause for it. 
# The time.sleep will add a slight pause.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;except KeyboardInterrupt:
    sys.exit() #This will end the program when click CTRL-C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;At last we use except for checking and executing the code.&lt;/li&gt;
&lt;li&gt;sys.exit() is used to end the program for us... whenever someone click CTRL-C on keyboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can download or check the code by click on this &lt;a href="https://colab.research.google.com/drive/1jutYYCLDt9zN9lHgqjWw3XBUZn36VzmO?usp=sharing" rel="noopener noreferrer"&gt;DOWNLOAD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MY SOCIAL HANDLES:&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/ihtesham-haider-079887218/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt; &lt;a href="https://medium.com/@ihteshamhaider" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; &lt;a href="https://twitter.com/techtimes101" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any problem regarding programming and management I free for you to help you!.&lt;/p&gt;

&lt;p&gt;Thanks! wish you Best Of Luck.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>programming</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Python Project: Click-Bait Titles Generator (with TUTORIAL)</title>
      <dc:creator>Ihtesham Haider</dc:creator>
      <pubDate>Sun, 03 Oct 2021 17:26:06 +0000</pubDate>
      <link>https://dev.to/ihtesham_haider/python-project-click-bait-titles-generator-with-infinity-4iap</link>
      <guid>https://dev.to/ihtesham_haider/python-project-click-bait-titles-generator-with-infinity-4iap</guid>
      <description>&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%2Fujtpjyh9m7osjglfsvrz.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%2Fujtpjyh9m7osjglfsvrz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Learn how to make clickbait or catchy titles generator with python and you can put this into your portfolio.&lt;/p&gt;

&lt;p&gt;Are you tired and you have a lot work to do like finding catchy article or blog headings if yes, this Click-bait generator will write millions of articles headers for you!!&lt;/p&gt;

&lt;p&gt;Today we will be making this powerful Python project with the help of only one module which is &lt;code&gt;random&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This program has functions for generating different kinds of clickbait titles. Each of them gets random words from STATES, NOUNS, PLACES,WHEN and list. This is a lot like Madlibs but it isn't madlibs because computer on by own do the work for us.&lt;/p&gt;

&lt;p&gt;Tricking people into your website is easy but creative content is difficult! But clickbait title generator made work some how easy for us. Now, my friend in this program there are a lot of text but the code is really straightforward which will make your day/night great.&lt;/p&gt;

&lt;p&gt;When you make this masterpiece you will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Know the basics of Python&lt;/li&gt;
&lt;li&gt;Know how to use functions&lt;/li&gt;
&lt;li&gt;Know format()&lt;/li&gt;
&lt;li&gt;Know how to manage things perfectly&lt;/li&gt;
&lt;li&gt;And will know how to smile! haha&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get started!!&lt;/p&gt;
&lt;h2&gt;
  
  
  Code | Discussion
&lt;/h2&gt;

&lt;p&gt;In this part we will just setting up the Constants.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

#The constants
OBJECT_PRONOUNS = ['Her', 'Him', 'Them']
SUSPECIOUS_PRONOUNS = ['Her', 'His', 'They']
PERSONAL_PRONOUNS = ['She', 'His', 'Their']
STATES = ['California', 'Texas', 'Florida', 'New York', 'Pennsylvania',
          'Illinois', 'Ohio', 'Georgia', 'North Carolina', 'Michigan']
NOUNS = ['Athlete', 'Clown', 'Shovel', 'Paleo Diet', 'Doctor',
         'Parent', 'Cat','Dog', 'Chicken', 'Robot', 'Video Game',
         'Avocado', 'Plastic Straw', 'Seriel Killer','Telephone Pyschic']
PLACES = [
    'House', 'Attic', 'Bank Deposit Box', 'School', 'Basement',
    'Workplace', 'Donut Shop', 'Apocalypse Bunker'
]
WHEN = ['Soon', 'This Year', 'Later', 'RIGHT NOW', 'Next Week']

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  DISCUSSION:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;import random&lt;/code&gt; if you're not familiar with this thing (random) you should give &lt;code&gt;2&lt;/code&gt; mins to read this &lt;a href="https://docs.python.org/3/library/random.html" rel="noopener noreferrer"&gt;Click to read&lt;/a&gt;
*Random generate random numbers for integers and other stuff if you have read it!!&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;#The constants&lt;/code&gt; In this part &lt;strong&gt;OBJECT_PRONOUNS, SUSPECIOUS_PRONOUNS, PERSONAL_PRONOUNS, STATES, NOUNS, PLACES, AND WHEN&lt;/strong&gt; work as the words which will be used as filling the blanks words.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Functions and loops
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#The_main_Function
def main():
    print('|| Click Bait Headlline Generator ||')
    print('|| By Ihtesham Haider ||')

    print()
    print('Make your website Grow with Catchy Headlines!!')

    #The_main_loop
    while True:
        print('Please, enter the number of Click-Bait headlines to generate!: ')
        response = input('&amp;gt; ')

        if not response.isdecimal():
            print('Please Enter a number..')
        else:
            numberOfHeadlines = int(response)
            break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  DISCUSSION:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;def main():&lt;/code&gt; the main function will have everything like:

&lt;ul&gt;
&lt;li&gt;While loops &lt;/li&gt;
&lt;li&gt;for loops etc&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;You can change the &lt;code&gt;print&lt;/code&gt; points if you want to! like change the name with yours By ---&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;while loop&lt;/code&gt; is the game changer this loop will generate the headlines or titles we want like if I want 1000 I will just input 1000 and it will generate it for me by this while loop.&lt;/li&gt;

&lt;li&gt;if have not read my previous python project discussion part so, I urge you to go the discussion part and this will become more easier to you.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i in range(numberOfHeadlines):
        clickbaitType = random.randint(1, 8)

        if clickbaitType ==1:
            headline = generateAreMillennialsKillingHeadline()
        elif clickbaitType ==2:
            headline = generateWhatYouDontKnowHeadline()
        elif clickbaitType ==3:
            headline = generateBigCompaniesHateHerHeadline()
        elif clickbaitType ==4:
            headline = generateYouWontBelieveHeadline()
        elif clickbaitType ==5:
            headline = generateDontWantYouToKnowHeadline()
        elif clickbaitType ==6:
            headline = generateGiftIdeaHeadline()
        elif clickbaitType ==7:
            headline = generateReasonsWhyHeadline()
        elif clickbaitType ==8:
            headline = generateJobAutomatedHeadline()

        print(headline)
    print()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  DISCUSSION:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;for loop&lt;/code&gt; is used after &lt;code&gt;break&lt;/code&gt; method. This loop will organize the text like in consecutive order... one by one&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;random.randint(1,8)&lt;/code&gt; is really important because with this we will have organize structured titles. The loop will take titles from. One from &lt;code&gt;millenialsKillinHeadline&lt;/code&gt; and so on...&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print()&lt;/code&gt; the empty print is used because of the last line which is really funny and it's an order!!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; website = random.choice(['website', 'blog', 'Facebook', 'Google',
                             'Facebook', 'Tweeter', 'Instagram'])
    when = random.choice(WHEN).lower()
    print('Post these to our', website, when, 'or you\'re fired!')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  DISCUSSION:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;website&lt;/code&gt; has random.choice which will randomly choose in this list tuple one of the word which is in list and put in a sentence which you will see soon.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;when&lt;/code&gt; makes the when part lower with lower() method like small text.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt; has a warning! Post these to our (website) (randomly adopt from website list) one word. And when from WHEN.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  The generator part!!
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def generateAreMillennialsKillingHeadline():
    noun = random.choice(NOUNS)
    return 'Are Millennials Killing the {} Industry?'.format(noun)

def generateWhatYouDontKnowHeadline():
    noun = random.choice(NOUNS)
    pluralNoun = random.choice(NOUNS) + 's'
    when = random.choice(WHEN)
    return 'Without This {}, {} Could Kill You {}'.format(noun, pluralNoun, when)

def generateBigCompaniesHateHerHeadline():
    pronoun = random.choice(OBJECT_PRONOUNS)
    state = random.choice(STATES)
    noun1 = random.choice(NOUNS)
    noun2 = random.choice(NOUNS)
    return 'Big Companies Hate {}! See How This {} {} Invented a Cheaper {}'.format(pronoun, state, noun1, noun2)

def generateYouWontBelieveHeadline():
    state = random.choice(STATES)
    noun = random.choice(NOUNS)
    pronoun = random.choice(SUSPECIOUS_PRONOUNS)
    place = random.choice(PLACES)
    return 'You Won\'t Believe What This {} {} Found in {} {}'. format(state, noun, pronoun, place)

def generateDontWantYouToKnowHeadline():
    pluralNoun1 = random.choice(NOUNS) + 's'
    pluralNoun2 = random.choice(NOUNS) + 's'
    return 'What {} Don\'t Want You To Know About {}'.format(pluralNoun1, pluralNoun2)

def generateGiftIdeaHeadline():
    number = random.randint(7, 15)
    noun = random.choice(NOUNS)
    state = random.choice(STATES)
    return '{} Gift Ideas to Give Your {} From {}'.format(number, noun, state)

def generateReasonsWhyHeadline():
    number1 = random.randint(3, 19)
    pluralNoun = random.choice(NOUNS) + 's'
    #number 2 should no longer than number1
    number2 = random.randint(1, number1)
    return '{} Reasons Why {} Are More Interesting Than You Think (Number {} Will Surprise You!)'.format(number1, pluralNoun, number2)

def generateJobAutomatedHeadline():
    state = random.choice(STATES)
    noun = random.choice(NOUNS)

    i = random.randint(0, 2)
    pronoun1 = SUSPECIOUS_PRONOUNS[i]
    pronoun2 = SUSPECIOUS_PRONOUNS[i]
    if pronoun1 == 'Their':
        return 'This {} {} Didn\'t Think Robots Would Take {} Job. {} Were Wrong.'.format(state, noun, pronoun1, pronoun2)
    else:
        return 'This {} {} Didn\'t Think Robots Would Take {} Job. {} Was Wrong'.format(state, noun, pronoun1, pronoun2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Discussion:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Each of &lt;code&gt;def&lt;/code&gt; means functions returns a different kind of headline/title.&lt;/li&gt;
&lt;li&gt;Like &lt;code&gt;def generateAreMillennialsKillingHeadline():&lt;/code&gt; will generate or returns &lt;code&gt;'Are Millennials Killing the {} Industry?'.format(noun)&lt;/code&gt; don't get overwhelmed I'm here to help whenever you need I'm here!. So this line will generate some kind of headline like "Are millenials killing the {noun will be take randomly like athelete or something!}"&lt;/li&gt;
&lt;li&gt;All the others will be taken the same. Like &lt;code&gt;def generateWhatYouDontKnowHeadline():&lt;/code&gt; this will generate or returns different kind of title... and so on..&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  last!
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Let's generate some Clickbait catchy titles Play the button!
if __name__ == '__main__':
    main()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when you run after this part the code you will see a message for input (for number!) when you put number like 2000 or 100 or maybe 10 the clickbait generator will generate random titles for you!.&lt;/p&gt;

&lt;p&gt;Now its your turn, play with this code! like change or add some other code to this and make it an amazing clickbait generator!.&lt;/p&gt;

&lt;p&gt;When you do let me know!.&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/ihtesham-haider-079887218/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt; &lt;a href="https://medium.com/@ihteshamhaider" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; &lt;a href="https://twitter.com/techtimes101" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://colab.research.google.com/drive/12PsH8wLCK7OtTIFpVLCxOW7pF178zlCd?usp=sharing" rel="noopener noreferrer"&gt;Download the Code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Python beginner Project: Calendar Builder</title>
      <dc:creator>Ihtesham Haider</dc:creator>
      <pubDate>Fri, 01 Oct 2021 15:42:58 +0000</pubDate>
      <link>https://dev.to/ihtesham_haider/python-beginner-project-calendar-builder-531l</link>
      <guid>https://dev.to/ihtesham_haider/python-beginner-project-calendar-builder-531l</guid>
      <description>&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%2F8hvcjcklulo38mcbs98f.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%2F8hvcjcklulo38mcbs98f.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hey, hi today we're gonna make a nice looking printable text file of monthly calendars for the month and year you desire.&lt;/p&gt;

&lt;p&gt;Don't scare from dates and calendars, yes, they are some tricky &lt;strong&gt;topic&lt;/strong&gt; in programming because there are so many different rules for condioning the number of the days in a month, which years are leap years, and which day of the week a particular date falls on.&lt;/p&gt;

&lt;p&gt;Thankfully, Python's &lt;strong&gt;datetime module&lt;/strong&gt; handles these details for us. We will generate a multiline string for the monthly calendar page.&lt;/p&gt;

&lt;p&gt;Are you still with me, if yes, let's make this shit!!&lt;/p&gt;

&lt;p&gt;Things you need to make &lt;strong&gt;This Calendar Builder&lt;/strong&gt; are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;IDE&lt;/a&gt; where you will write your code&lt;/li&gt;
&lt;li&gt;Python installed from &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;python official website&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Then you're good to go!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First steps:&lt;br&gt;
Make a file &lt;code&gt;Caledar_builder.py&lt;/code&gt;&lt;br&gt;
Now Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import datetime
# Set up the constants:
DAYS = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
        'Friday', 'Saturday')
MONTHS = ('January', 'February', 'March', 'April', 'May', 'June', 'July',
          'August', 'September', 'October', 'November', 'December')

print('|| Calender-Builder ||')

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;import datetime which is a python module. If you don't know about it &lt;a href="https://docs.python.org/3/library/datetime.html" rel="noopener noreferrer"&gt;Check this&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Setting up the constants Days name and months name.&lt;/li&gt;
&lt;li&gt;Print the Calender Builder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;After this&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;while True:  # Loop to get a year from the user.
    print('Enter the year for the calendar:')
    response = input('&amp;gt; ')

    if response.isdecimal() and int(response) &amp;gt; 0:
        year = int(response)
        break

    print('Please enter a numeric year, like 2023.')
    continue

while True:  # Loop to get a month from the user.
    print('Enter the month for the calendar, 1-12:')
    response = input('&amp;gt; ')

    if not response.isdecimal():
        print('Please enter a numeric month, like 3 for March.')
        continue

    month = int(response)
    if 1 &amp;lt;= month &amp;lt;= 12:
        break

    print('Please enter a number from 1 to 12.')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;First loop is to get the year from the user 

&lt;ul&gt;
&lt;li&gt;print the message &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;response variable contains input which will appear to the user to give Answer like the Year (2050)&lt;/li&gt;

&lt;li&gt;if condition to see the user put correct answer or not! by saying this I mean numeric value&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;The second loop:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Second loop is to get the month from the user.&lt;/li&gt;
&lt;li&gt;And if statement to look up to the input of the user......&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;After this&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;def getCalendarFor(year, month):
    calText = '' 

    calText += (' ' * 34) + MONTHS[month - 1] + ' ' + str(year) + '\n'

    calText += '...Sun.....Mon....Tue..Wed...Thur....Fri....Sat..\n'

    weekSeparator = ('+----------' * 7) + '+\n'

    blankRow = ('|          ' * 7) + '|\n'
    currentDate = datetime.date(year, month, 1)
    while currentDate.weekday() != 6:
        currentDate -= datetime.timedelta(days=1)

    while True:  # Loop over each week in the month.
        calText += weekSeparator
        dayNumberRow = ''
        for i in range(7):
            dayNumberLabel = str(currentDate.day).rjust(2)
            dayNumberRow += '|' + dayNumberLabel + (' ' * 8)
            currentDate += datetime.timedelta(days=1) # Go to next day.
        dayNumberRow += '|\n'  # Add the vertical line after Saturday.

        # Add the day number row and 3 blank rows to the calendar text.
        calText += dayNumberRow
        for i in range(3):  # (!) Try changing the 4 to a 5 or 10.
            calText += blankRow

        # Check if we're done with the month:
        if currentDate.month != month:
            break

    # Add the horizontal line at the very bottom of the calendar.
    calText += weekSeparator
    return calText

calText = getCalendarFor(year, month)
print(calText)  # Display the calendar.

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

&lt;/div&gt;



&lt;p&gt;Are you still with me this one will be a bit big!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;def (declaration of Python function) getCalendarFor(year, month) will get the year and month.&lt;/li&gt;
&lt;li&gt;calText will contain the string of our calendar.&lt;/li&gt;
&lt;li&gt;3 line will Put the month and year at the top of the calendar:&lt;/li&gt;
&lt;li&gt;4 line Add the days of the week labels to the calendar:

&lt;ul&gt;
&lt;li&gt;Try to change the abbreviations to SUN, MON and so forth to the week days if you want.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;code&gt;weekSeparator&lt;/code&gt; The horizontal line string that separate weeks:&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;blankRow&lt;/code&gt; The blank rows have ten spaces in between the | day separators:&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;while currentDate.weekday() != 6:&lt;/code&gt; Get the first date in the month. (The datetime module handles all the complicated calendar stuff for us here.)

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;currentDate = datetime.date(year, month, 1)&lt;/code&gt;
Roll back currentDate until it is Sunday. (weekday() returns 6 for Sunday, not 0.)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;dayNumberRow&lt;/code&gt; is the row with the day number labels:&lt;/li&gt;

&lt;li&gt; &lt;code&gt;for i in range(3):&lt;/code&gt; (!) Try changing the 4 to a 5 or 10.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;calText = getCalendarFor(year, month)&lt;/code&gt;
&lt;code&gt;print(calText)&lt;/code&gt;  # Display the calendar.
&lt;h3&gt;
  
  
  To save the printed code in a file
&lt;/h3&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Save the calendar to a text file:
calendarFilename = 'calendar_{}_{}.txt'.format(year, month)
with open(calendarFilename, 'w') as fileObj:
    fileObj.write(calText)

print('Saved to ' + calendarFilename)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the code and then give me Reply!&lt;br&gt;
For contacting me follow my handles.&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/ihtesham-haider-079887218/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt; &lt;a href="https://medium.com/@ihteshamhaider" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; &lt;a href="https://twitter.com/techtimes101" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>project</category>
    </item>
  </channel>
</rss>
