<?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: no longer crazy</title>
    <description>The latest articles on DEV Community by no longer crazy (@nolongercrazy).</description>
    <link>https://dev.to/nolongercrazy</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%2F1086134%2Fda6eefe5-3fb4-4182-840f-9e2fe7d0affc.png</url>
      <title>DEV Community: no longer crazy</title>
      <link>https://dev.to/nolongercrazy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nolongercrazy"/>
    <language>en</language>
    <item>
      <title>Python Journey: Day 1 - Exploring Print, Input, Variables, and String Manipulation</title>
      <dc:creator>no longer crazy</dc:creator>
      <pubDate>Sat, 20 May 2023 12:40:58 +0000</pubDate>
      <link>https://dev.to/nolongercrazy/python-journey-day-1-exploring-print-input-variables-and-string-manipulation-4a2m</link>
      <guid>https://dev.to/nolongercrazy/python-journey-day-1-exploring-print-input-variables-and-string-manipulation-4a2m</guid>
      <description>&lt;p&gt;Welcome to Day 1 of our Python journey! Today, we dive into the basics of Python programming and explore fundamental concepts such as the print function, input function, variables, and string manipulation. By the end of this blog, you'll have a solid understanding of these concepts and even complete a project to swap two variables. Let's get started!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Print Function:
The print function is an essential tool in Python that allows us to display information on the screen. It's as simple as using the print keyword followed by parentheses containing the text or variables you want to display. Let's take a look at an example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"My name is Ifedayo"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code snippet will output the text "My name is Ifedayo" to the console.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Input Function:
The input function enables us to receive input from the user during program execution. It prompts the user with a message and waits for them to provide input. The input function stores the user's input as a string. Here's an example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&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;"Please enter your name: "&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;"Hello, "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"! Nice to meet you."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, the input function prompts the user to enter their name. The entered name is stored in the variable &lt;code&gt;name&lt;/code&gt;, which is then used in the print statement to greet the user.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Variables:
Variables are containers used to store data in Python. They can hold different types of values, such as numbers, strings, or even more complex data structures. Let's see an example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello, world!"&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;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we assign the string "Hello, world!" to the variable &lt;code&gt;message&lt;/code&gt;. Then, we use the print function to display the value of the variable, which is "Hello, world!" in this case.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;String Manipulation:
Python provides various ways to manipulate strings, such as concatenation, slicing, and formatting. One simple string manipulation technique is joining two strings together using the "+" operator. Let's look at an example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"John"&lt;/span&gt;
&lt;span class="n"&gt;last_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Doe"&lt;/span&gt;
&lt;span class="n"&gt;full_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;last_name&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;full_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, we create two variables &lt;code&gt;first_name&lt;/code&gt; and &lt;code&gt;last_name&lt;/code&gt; to store the respective names. Then, we concatenate the two variables with a space in between to create the &lt;code&gt;full_name&lt;/code&gt; variable. Finally, we print the value of &lt;code&gt;full_name&lt;/code&gt;, which will be "John Doe" in this case.&lt;/p&gt;

&lt;p&gt;Project: Swapping Two Variables:&lt;br&gt;
As a beginner exercise, we can create a small project to swap the values of two variables. Here's an example implementation:&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;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&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;"Before swapping:"&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;"a ="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&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;"b ="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Swapping the values
&lt;/span&gt;&lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;temp&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;"After swapping:"&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;"a ="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&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;"b ="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this project, we have two variables &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; with initial values. By using a temporary variable &lt;code&gt;temp&lt;/code&gt;, we can swap the values of &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;. After the swap, we print the values of &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; to verify the successful swap.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
Congratulations on completing Day 1 of our Python journey! We explored the print function, input function, variables, and string manipulation. You've learned how to display information, receive user input, store data in variables, manipulate strings, and even completed a project&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>ifedayoakinsira</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
