<?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: Daniel</title>
    <description>The latest articles on DEV Community by Daniel (@edaw003).</description>
    <link>https://dev.to/edaw003</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%2F357153%2Fb86a68c8-4032-48a7-8cf6-6a00b10407cf.png</url>
      <title>DEV Community: Daniel</title>
      <link>https://dev.to/edaw003</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edaw003"/>
    <language>en</language>
    <item>
      <title>The 1st program and the magnificent print statement (Python programming language)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Tue, 31 Mar 2020 12:54:22 +0000</pubDate>
      <link>https://dev.to/edaw003/the-1st-program-and-the-magnificent-print-statement-python-programming-language-1pdm</link>
      <guid>https://dev.to/edaw003/the-1st-program-and-the-magnificent-print-statement-python-programming-language-1pdm</guid>
      <description>&lt;p&gt;In most of the programming languages, the 1st program a student learns to write is the so-called “Hello World!” program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(“Hello World!”)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This one-line program will give an output (print on the screen) the message &lt;strong&gt;Hello World!&lt;/strong&gt;.&lt;br&gt;
   The things that this simple program is showing us, are the following:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;– to print something on the screen, the print statement should be used. &lt;br&gt;
– the message that we want to be printed is written between quotation marks “”.&lt;br&gt;
– what is with round brackets? The brackets are part of the print statement: print(). The message that needs to be printed must be inserted between the brackets.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Can ‘ be used instead of “?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Answer:&lt;/strong&gt; Yes, Try it yourself.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Are there any benefits when using one or another?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Answer:&lt;/strong&gt; Yes, and I will let you figure it out by writing the following examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(‘Dog’s bone’)&lt;/strong&gt;&lt;br&gt;
             ^&lt;br&gt;
SyntaxError: invalid character in identifier&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(“Using this ” mark here will give an error!”)&lt;/strong&gt;&lt;br&gt;
               ^&lt;br&gt;
SyntaxError: invalid character in identifier&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(‘Here the sign ” will not give any error’)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(‘Here the sign ” will not give any error’)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If our message contains &lt;strong&gt;‘&lt;/strong&gt; we must enclose it between &lt;strong&gt;” “&lt;/strong&gt;. The same situation is also for the &lt;strong&gt;”&lt;/strong&gt; sign, it must be enclosed between &lt;strong&gt;‘ ‘&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;But what can we do if we really want to write a message that contains ‘ and it is enclosed between’ ‘?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Answer:&lt;/strong&gt; Python will let us do this with the help of an escape character.&lt;/p&gt;

&lt;p&gt;The escape character is a backslash () plus the character/sign that we want to be included in the message (character/sign that normally would give a syntax error or with the help of backslash, can have a different meaning ).&lt;/p&gt;

&lt;p&gt;Now, let’s try again to write in the console the examples from above where Phyton complained about a syntax error, but this time using backslash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;print(“Using this \” mark here will give an error!”)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;print(‘Dog\’s bone’)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;See you next time.&lt;/p&gt;

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