<?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: dinesh chinnathurai</title>
    <description>The latest articles on DEV Community by dinesh chinnathurai (@dinesh_chinnathurai_136b1).</description>
    <link>https://dev.to/dinesh_chinnathurai_136b1</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%2F1747415%2F3d9b6f0c-50da-40b6-b11a-cf996f207cfa.png</url>
      <title>DEV Community: dinesh chinnathurai</title>
      <link>https://dev.to/dinesh_chinnathurai_136b1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dinesh_chinnathurai_136b1"/>
    <language>en</language>
    <item>
      <title>Learn Python - Day 2</title>
      <dc:creator>dinesh chinnathurai</dc:creator>
      <pubDate>Wed, 10 Jul 2024 10:05:29 +0000</pubDate>
      <link>https://dev.to/dinesh_chinnathurai_136b1/learn-python-day-2-134k</link>
      <guid>https://dev.to/dinesh_chinnathurai_136b1/learn-python-day-2-134k</guid>
      <description>&lt;h2&gt;
  
  
  Print Methods
&lt;/h2&gt;

&lt;p&gt;Print() function is used to print the output in console and also it has the ability to handle formatting, special characters, Unicode and so on. We will see it one by one with examples&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Basic usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It prints the given text or data to the console.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello, World!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Hello, World!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Multiple Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It prints multiple objects with space as separator by default.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello", "World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Hello World&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Sep Parameter&lt;/strong&gt;&lt;br&gt;
We can override the default separator space by using the &lt;strong&gt;sep&lt;/strong&gt; parameter.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello", "World", sep=", ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we used comma space as separator between the objects. Likewise we can use anything as separator.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Hello, World&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. End Parameter&lt;/strong&gt;&lt;br&gt;
We can set what is printed at the end of the output using &lt;strong&gt;end&lt;/strong&gt; parameter. It set as newline by default (\n).&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello, World", end="!")
print(" How are you?")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we changed the new line parameter into exclamatory symbol using end parameter, so that both print methods are printed as single line as show below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Hello, World! How are you?&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Printing variable&lt;/strong&gt;&lt;br&gt;
It prints the value of the variables in console&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; name = "Dinesh"
 age = 25
 print("Name:", name, "Age:", age)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Name: Dinesh Age: 25&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Formatted String Literals (f-strings)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can include the expressions inside string literals using curly braces {}.&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age = 25
name = "Dinesh"
print(f"Name: {name}, Age: {age}")   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Dinesh, Age: 25&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. String Formatting with % Operator&lt;/strong&gt;&lt;br&gt;
   Using % operator we can format the strings.&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "Dinesh"
age = 25
print("Name: %s, Age: %d" % (name, age))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;br&gt;
&lt;code&gt;Name: Dinesh, Age: 25&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. String Formatting with str.format()&lt;/strong&gt;&lt;br&gt;
     Uses the str.format() method to format strings.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "Dinesh"
age = 25
print("Name: {}, Age: {}".format(name, age))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Name: Dinesh, Age: 25&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Printing with File&lt;/strong&gt;&lt;br&gt;
      Redirects the output to a file.&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;with open("d:\\output.txt", "w") as file:
    print("Hello, World!", file=file)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The text "Hello, world!" will write in txt file in the path "d:\output.txt"   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Printing with Flush&lt;/strong&gt;&lt;br&gt;
      Ensures the output is immediately flushed to the console.&lt;br&gt;
&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import time
for i in range(5):
 print(i, end=' ', flush=True)
time.sleep(1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0 1 2 3 4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. Printing Special Characters&lt;/strong&gt;&lt;br&gt;
       Prints special characters like tab (\t), newline (\n), and backslash (\).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Tab\tSpace")
print("New\nLine")
print("Backslash\\Example")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Tab     Space&lt;br&gt;
New&lt;br&gt;
Line&lt;br&gt;
Backslash\Example&lt;/code&gt;&lt;/p&gt;

</description>
      <category>chapter</category>
      <category>1</category>
    </item>
    <item>
      <title>Learn Python - Day 1</title>
      <dc:creator>dinesh chinnathurai</dc:creator>
      <pubDate>Tue, 09 Jul 2024 12:34:41 +0000</pubDate>
      <link>https://dev.to/dinesh_chinnathurai_136b1/python-learning-59e7</link>
      <guid>https://dev.to/dinesh_chinnathurai_136b1/python-learning-59e7</guid>
      <description>&lt;h2&gt;
  
  
  Chapter 1
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What python can do?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python is versatile programming language and known for its simplicity and readability&lt;/li&gt;
&lt;li&gt;Python can do many things like web development, Data analysis and visualization, AI and ML, scripting for automation, Desktop GUI application, database access and so on.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Python language simplicity, versatility, community support, and industry adoption make it a preferred choice for a wide range of applications, and it is now effectively used in the field of Finance, Data visualization, ML and AI. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python syntax is easy to understand, and it resembles human language. &lt;/li&gt;
&lt;li&gt;It supports multiple programming concepts like procedural, object-oriented and functional programming.&lt;/li&gt;
&lt;li&gt;It has large active community of developers to support, knowledge sharing, contribute to python open-source projects and so on.&lt;/li&gt;
&lt;li&gt;Python can run in various platforms like windows, Linux, IOS.&lt;/li&gt;
&lt;li&gt;Python is an open-source software (Free to use) &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Python syntax compared to other programming language.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python syntax is concise and emphasizes readability with minimal syntactic terms and indentation is used to define the structure of the code, making it clear and organized.&lt;/li&gt;
&lt;li&gt;In other programming languages, the explicit syntax with curly braces to define blocks of code and it requires more syntactic terms are used to code for method definitions class structures&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;windows:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the latest package from the below link or browse the supported package based on your windows OS.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe" rel="noopener noreferrer"&gt;https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Double click exe file and proceed with installation in as per the instructions provided in the installation window and until successful installation &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;To verify installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open command prompt and type python, if it installed properly you will see the below information with version details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C:\Users\Win11&amp;gt;python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun  6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32&lt;br&gt;
Type "help", "copyright", "credits" or "license" for more information.&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the terminal window&lt;/li&gt;
&lt;li&gt;Run the command "apt-get install python"&lt;/li&gt;
&lt;li&gt;Follow the prompts to complete the installation&lt;/li&gt;
&lt;li&gt;Alternatively, download the Python package for Ubuntu from the official Python website and install it manually.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;To verify installation *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open terminal&lt;/li&gt;
&lt;li&gt;Type "python -version"&lt;/li&gt;
&lt;li&gt;It shows the python version details &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;First python program with print() statement&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open command prompt in windows and type python&lt;/li&gt;
&lt;li&gt;Then type python command/code - Refer below image&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We can use editor to type code like VS code, sublime, notepad++ etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have google collab editor to practice python program&lt;br&gt;
&lt;a href="https://colab.research.google.com/" rel="noopener noreferrer"&gt;https://colab.research.google.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
