<?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: मौसम अधिकरी</title>
    <description>The latest articles on DEV Community by मौसम अधिकरी (@mausamadh).</description>
    <link>https://dev.to/mausamadh</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F52361%2F0c61855e-b884-409b-8ac4-c3504eeaca7d.jpg</url>
      <title>DEV Community: मौसम अधिकरी</title>
      <link>https://dev.to/mausamadh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mausamadh"/>
    <language>en</language>
    <item>
      <title>Virtual Environment For My First Python Program</title>
      <dc:creator>मौसम अधिकरी</dc:creator>
      <pubDate>Sat, 21 Mar 2020 11:27:28 +0000</pubDate>
      <link>https://dev.to/mausamadh/virtual-environment-for-my-first-python-program-59nc</link>
      <guid>https://dev.to/mausamadh/virtual-environment-for-my-first-python-program-59nc</guid>
      <description>&lt;p&gt;Here We will create a virtual environment and code inside the environment.&lt;br&gt;
So why virtual Environment?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to separate and isolate the packages we are using for different programs and projects.&lt;/li&gt;
&lt;li&gt;working with code that depends on different versions of some library.&lt;/li&gt;
&lt;li&gt;This issue happens a lot when dealing with Python 2 and Python 3. &lt;/li&gt;
&lt;li&gt;Having different versions of packages installed can lead to a lot of confusion and bugs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s much better to have separate environments for separate programs.&lt;/p&gt;

&lt;p&gt;The module we use to create virtual environment here is called &lt;a href="https://docs.python.org/3/library/venv.html"&gt;venv&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;venv will install most recent version of python that is available.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To create a virtual environment, We have to decide upon a directory where we want to place it. And run venv module as script with directory path.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Suppose we want to create a virtual environment at home/dev:&lt;br&gt;
then change directory to the path as follows&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $cd home/dev
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now inside the directory we will run venv script:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     ~/dev$ python -m venv python-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;What this does is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;creates python-dev directory if it doesn't exist&lt;/li&gt;
&lt;li&gt;also creates directories inside it containing a copy of the python interpreter, the standard library and various supporting files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once we have created Virtual Environment, We have to activate it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Run following command&lt;br&gt;
&lt;strong&gt;On Windows&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; python-dev\scripts\activate
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, extension for activate file should be mentioned whether its .bat for cmd or .ps1 for Power shell. &lt;br&gt;
In cmd,&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Scripts\activate.bat
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and in PowerShell,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     Scripts\Activate.ps1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://dev.to/mausamadhikari5/virtual-environment-for-my-first-python-program-59nc"&gt;Updated through comment &lt;/a&gt;&lt;br&gt;
&lt;strong&gt;on Linux or Mac&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     source python-dev/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After activating, we can start programming.&lt;br&gt;
now create main.py file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;if you have vs code installed then you can simply type code main.py in your terminal.&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ~/dev/python-dev $ code main.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This opens a main.py file in vscode editor.&lt;br&gt;
Now we can code our first Python Program Here.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     def main():
         print("hello world!")
     if __name__=="__main__":
         main() 
     else:
         print("file invoked")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For more &lt;a href="https://blogs.mausamadhikari.com.np/2021/02/virtual-environment-for-my-first-python.html"&gt;Visit Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Functions in Python</title>
      <dc:creator>मौसम अधिकरी</dc:creator>
      <pubDate>Sat, 21 Mar 2020 11:18:50 +0000</pubDate>
      <link>https://dev.to/mausamadh/functions-in-python-11k8</link>
      <guid>https://dev.to/mausamadh/functions-in-python-11k8</guid>
      <description>&lt;p&gt;What is function?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Function is way of problem solving by dividing the problem into sub-problems and finding their individual solution and combining them to solve original problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Function Definition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;defining the role of function&lt;/li&gt;
&lt;li&gt;actions to be performed by functions are written in the form of statements here.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;syntax:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    def function_name(parameters_seperated_by_commas):
        statements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;notice the &lt;strong&gt;:&lt;/strong&gt; and indentation i.e four white spaces.&lt;/p&gt;

&lt;p&gt;Some Rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;function_name must not be python keyword&lt;/li&gt;
&lt;li&gt;code following colon(:) must be indented.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Function Call:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;calling the defined function&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;to execute the work we need to call the defined function.&lt;br&gt;
to execute function, We need to invoke function.&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; function_name(arguments_seperated_by_commas)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suppose we want to write a program that draws a house, a car and a cat.&lt;br&gt;
Without use of function we end up writing whole code for drawing house, a car and a cat at a place.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     def main():
         statements for drawing house
         statements for drawing car
         statements for drawing cat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;which works fine but tracking, debugging is difficult and probably not the best practice.&lt;br&gt;
so what we do here is make function for individual work like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     def draw_house():
         statements

     def draw_car():
         statements

     def draw_cat():
         statements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and we will call the defined function in our main function as:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     def main():&lt;br&gt;
         draw_house()&lt;br&gt;
         draw_car()&lt;br&gt;
         draw_cat()&lt;br&gt;
         print("task completed")&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Types of Functions:&lt;br&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Void Functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The function that doesn't return anything.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;simply speaking, The return type is None&lt;br&gt;
for example:&lt;br&gt;
If we want to add two numbers given to function and print it's result then:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def addition(num1,num2):
    print(f"{num1}+{num2}=",num1+num2)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Fruitful Functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The function that returns some value&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The return type is not null.&lt;br&gt;
for example:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def addition(num1,num2):
    return num1+num2
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more &lt;a href="https://blogs.mausamadhikari.com.np/2021/02/functions-in-python.html"&gt;Visit Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>functions</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Setting Up Environment For Python</title>
      <dc:creator>मौसम अधिकरी</dc:creator>
      <pubDate>Fri, 20 Mar 2020 18:23:54 +0000</pubDate>
      <link>https://dev.to/mausamadh/setting-up-environment-for-python-4e1l</link>
      <guid>https://dev.to/mausamadh/setting-up-environment-for-python-4e1l</guid>
      <description>&lt;h5&gt;
  
  
  Before Installing any software on your device consider the following
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Whether your System is 32-bit or 64-bit&lt;/li&gt;
&lt;li&gt;Which OS you are Using Mac/Linux/Windows&lt;/li&gt;
&lt;li&gt;Memory space&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Python is Pre-installed in Linux and Mac.
&lt;/h4&gt;

&lt;p&gt;To open python shell:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open Terminal&lt;/li&gt;
&lt;li&gt;Type &lt;strong&gt;Python&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;you will see&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Now Type the following there:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt;print("hello World!")
hello World!
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you want to have python3 but getting python2.7 instead then run this in your bash shell&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo "alias python=/usr/local/bin/python3" &amp;gt;&amp;gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;what this does is this points python3,when python is called instead of python2.7.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Windows&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download Python installation file from &lt;a href="https://www.python.org/downloads/windows/"&gt;Python.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;After starting the installer, one of two options may be selected:&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;If you select “Install Now”:

&lt;ul&gt;
&lt;li&gt;Python will be installed into your user directory&lt;/li&gt;
&lt;li&gt;The standard library, test suite, launcher and pip will be installed&lt;/li&gt;
&lt;li&gt;If selected, the install directory will be added to your PATH.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;On selecting Install Now, the setup process begins and wait for the installation to complete.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Once the installation completes, choose Close.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;P.S. By selecting &lt;strong&gt;‘Add Python 3.X to PATH’&lt;/strong&gt; will save some troublesome of adding PATH to your system variables.&lt;/p&gt;

&lt;p&gt;Since you can't do all the stuffs in console so we need an Editor.&lt;br&gt;
I use &lt;a href="https://code.visualstudio.com/"&gt;VS Code&lt;/a&gt;&lt;br&gt;
but there are many different editors out there of your choice. like Sublime text , Atom , Pycharm and so on&lt;/p&gt;

&lt;p&gt;For more &lt;a href="https://blogs.mausamadhikari.com.np/2021/02/setting-up-environment-for-python.html"&gt;Visit Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introducing Python</title>
      <dc:creator>मौसम अधिकरी</dc:creator>
      <pubDate>Fri, 20 Mar 2020 16:57:09 +0000</pubDate>
      <link>https://dev.to/mausamadh/introducing-python-4l21</link>
      <guid>https://dev.to/mausamadh/introducing-python-4l21</guid>
      <description>&lt;p&gt;Introducing Python:&lt;/p&gt;

&lt;h1&gt;
  
  
  Python is High level interpreted language.
&lt;/h1&gt;

&lt;p&gt;&lt;a href="//python.org"&gt;Python&lt;/a&gt; is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;easy to learn&lt;/li&gt;
&lt;li&gt;interactive programming language&lt;/li&gt;
&lt;li&gt;efficient high level data structures&lt;/li&gt;
&lt;li&gt;simple but effective approach to Object Oriented Programming.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python's elegant syntax and dynamic typing together with it's interpreted nature ,makes python an ideal language for scripting and rapid application development in many areas on most platforms.&lt;/p&gt;

&lt;h5&gt;
  
  
  Python was developed by Guido Van Rossum in 1991 at the National Research institute for mathematics and computer science in Netherlands.
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Naming of python was inspired from his favorite comedy show Monty's Python's Flying Circus.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Features Of Python:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy To learn and Use&lt;/li&gt;
&lt;li&gt;Expressive language i.e more understandable and more readable&lt;/li&gt;
&lt;li&gt;Interpreted language&lt;/li&gt;
&lt;li&gt;Cross platform language&lt;/li&gt;
&lt;li&gt;Free and Open-source&lt;/li&gt;
&lt;li&gt;Object Oriented Language&lt;/li&gt;
&lt;li&gt;Extensible language - C , C++ can be used to compile code&lt;/li&gt;
&lt;li&gt;Large Standard Library&lt;/li&gt;
&lt;li&gt;GUI programming Support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://wiki.python.org/moin/Applications"&gt;Applications&lt;/a&gt; of Python:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web applications like Django , Pyramid , Flask&lt;/li&gt;
&lt;li&gt;Desktop GUI applications using &lt;a href="https://wiki.python.org/moin/TkInter"&gt;Tk&lt;/a&gt; , &lt;a href="https://docs.wxwidgets.org/3.0/overview_python.html"&gt;Wxwigets&lt;/a&gt; , &lt;a href="//kivy.org"&gt;kivi&lt;/a&gt; , &lt;a href="https://wiki.python.org/moin/PyQt"&gt;PYQt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Software Development for build ,control ,management and testing etc&lt;/li&gt;
&lt;li&gt;Scientific and Numeric applications like &lt;a href="https://www.scipy.org"&gt;Scipy&lt;/a&gt; , &lt;a href="https://pandas.pydata.org/"&gt;Pandas&lt;/a&gt; , &lt;a href="https://numpy.org"&gt;Numpy&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Business Application like ERP, E-commerce as &lt;a href="https://www.tryton.org/"&gt;Tryton&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Console Based Application like &lt;a href="https://ipython.org/"&gt;Ipython&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Audio-Video based Application like Timeplayer , &lt;a href="https://directory.fsf.org/wiki/Cplay"&gt;Cplay&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;3D CAD Applications like Fandango&lt;/li&gt;
&lt;li&gt;Enterprise Application like OpenERP , Tryton , Picalo&lt;/li&gt;
&lt;li&gt;Application for Images like &lt;a href="https://vpython.org/"&gt;Vpython&lt;/a&gt; , &lt;a href="http://www.goghproject.com/"&gt;Gogh&lt;/a&gt; , &lt;a href="https://sourceforge.net/projects/imgseek/"&gt;Imgseek&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For More &lt;a href="https://blogs.mausamadhikari.com.np/2021/02/introducing-python.html"&gt;Visit Here&lt;/a&gt;&lt;/p&gt;

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