<?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: America Alvarez</title>
    <description>The latest articles on DEV Community by America Alvarez (@america_alvarez_cda9c546a).</description>
    <link>https://dev.to/america_alvarez_cda9c546a</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%2F2513425%2F2d6e4eb6-cbec-4712-9564-1ccf2a84f264.png</url>
      <title>DEV Community: America Alvarez</title>
      <link>https://dev.to/america_alvarez_cda9c546a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/america_alvarez_cda9c546a"/>
    <language>en</language>
    <item>
      <title>Embracing Python: A Guide to Transitioning</title>
      <dc:creator>America Alvarez</dc:creator>
      <pubDate>Tue, 10 Dec 2024 17:06:05 +0000</pubDate>
      <link>https://dev.to/america_alvarez_cda9c546a/embracing-python-a-guide-to-transitioning-3mmj</link>
      <guid>https://dev.to/america_alvarez_cda9c546a/embracing-python-a-guide-to-transitioning-3mmj</guid>
      <description>&lt;h2&gt;
  
  
  Table Of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Popularity&lt;/li&gt;
&lt;li&gt;Variables&lt;/li&gt;
&lt;li&gt;Outputs&lt;/li&gt;
&lt;li&gt;Comments&lt;/li&gt;
&lt;li&gt;Conditional statements&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Loops&lt;/li&gt;
&lt;li&gt;Reflections&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Learning a new language can be difficult. I've been learning &lt;strong&gt;Python&lt;/strong&gt; on my own, and it has been an exciting and challenging adventure. The most challenging aspects have been maintaining accountability and finding inspiration, particularly when things seem to be moving slowly. But every small accomplishment, like as figuring out how loops work or making a function work, has motivated me to keep continuing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Popularity
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt; is currently the most widely used programming language in the employment market. It has held the top spot on the TIOBE Index since last year. Its simplicity, adaptability, and popularity make it a must-know language for growing developers. &lt;/p&gt;

&lt;p&gt;What drew me to study &lt;strong&gt;Python&lt;/strong&gt; was its clear and concise syntax and its similarity to &lt;strong&gt;JavaScript&lt;/strong&gt;. Additionally, its versatility allows developers to seamlessly transition between different types of projects, from web development to data analysis. Its power when it comes to web development and using frameworks like Django are essential for a web developer such as myself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;JavaScript&lt;/strong&gt;, we use const, let, or var to declare variables. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const greeting = "Hello"; 

let name = “America”
name = “Clove”

console.log(name) =&amp;gt; “Clove”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;const&lt;/code&gt; variables are immutable unless they hold arrays or objects.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; variables are mutable and can be reassigned.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; is an older version of declaring variables. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Var&lt;/code&gt; is function-scoped instead of block-scoped which can cause errors and confusion such as hoisting. In modern &lt;strong&gt;Javascript&lt;/strong&gt;, it is uncommon and discouraged from being used. &lt;code&gt;const&lt;/code&gt; and &lt;code&gt;let&lt;/code&gt; are the preferred variables to use. &lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Python&lt;/strong&gt;, variables are declared by assigning a value to a unique name. If you want to indicate a constant, you should name the variable in all uppercase letters, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greeting = "Good morning"  
MY_NAME = "America"  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, unlike &lt;strong&gt;JavaScript&lt;/strong&gt;, &lt;strong&gt;Python&lt;/strong&gt; doesn’t enforce immutability for constants. This means even if you name a variable in all caps to signify it shouldn’t change, &lt;strong&gt;Python&lt;/strong&gt; will allow you to reassign it without any error or warning. This is an important difference from &lt;strong&gt;JavaScript&lt;/strong&gt; because it illustrates the importance of developer discipline and conventions in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Displaying Outputs
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;JavaScript&lt;/strong&gt;, we use &lt;code&gt;console.log()&lt;/code&gt; to display output in the terminal. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log('Hello');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;strong&gt;Python&lt;/strong&gt;, we use the &lt;code&gt;print()&lt;/code&gt; function instead:&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') 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displaying outputs is essential for a coder. It helps debug and understand what your code is doing at certain points in the code. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conditional statements
&lt;/h2&gt;

&lt;p&gt;Conditional statements in &lt;strong&gt;JavaScript&lt;/strong&gt; include &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;else if&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt;. Code blocks are determined using the curly braces. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (x &amp;gt; 0) {  
  console.log("Positive");  
} else {  
  console.log("Non-positive");  
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;strong&gt;Python&lt;/strong&gt;, conditional statements using &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;elif&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt; with indentation are required to define blocks. Unlike &lt;strong&gt;Javascript&lt;/strong&gt;, &lt;strong&gt;Python&lt;/strong&gt; does not have curly braces to help determine a block.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if x &amp;gt; 0:  
    print("Positive")  
else:  
    print("Non-positive") 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key Difference: &lt;br&gt;
In &lt;strong&gt;Python&lt;/strong&gt;, indentation is important for the code to run correctly. It helps the system understand where there is a block of code. Improper indentation will result in errors. While &lt;strong&gt;Javascript&lt;/strong&gt;, use the curly braces to determine the block of codes. &lt;/p&gt;
&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;JavaScript&lt;/strong&gt;, we define functions using the &lt;code&gt;function&lt;/code&gt; keyword or arrow functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function greet() {  
  console.log("Hello");  
}  

const greet = () =&amp;gt; {  
  console.log("Hello");  
};  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;strong&gt;Python&lt;/strong&gt;, functions are defined using the &lt;code&gt;def&lt;/code&gt; keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def greet():  
    print("Hello")  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Loops
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JavaScript&lt;/strong&gt; offers &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;for...of&lt;/code&gt;, and &lt;code&gt;while&lt;/code&gt; loops for iteration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (let i = 0; i &amp;lt; 5; i++) {  
  console.log(i);  
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;br&gt;
The &lt;code&gt;for&lt;/code&gt; loop iterates from 0 to 4. To create a &lt;code&gt;for&lt;/code&gt; loop, we must initialize i to a starting value (in this case, 0). We create a condition (i &amp;lt; 5) to determine if the loop should continue running. If i is less than 5, the loop executes. Finally, i++ increments i by 1 after each iteration. This loop prints the numbers 0 to 4.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Python&lt;/strong&gt;, we use &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; loops, but &lt;code&gt;for&lt;/code&gt; loops are often used with iterators:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i in range(5):  
    print(i) 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;br&gt;
The &lt;code&gt;range(5)&lt;/code&gt; function generates numbers from 0 to 4, similar to the &lt;strong&gt;JavaScript&lt;/strong&gt; loop above. Creating a for loop in &lt;strong&gt;Python&lt;/strong&gt; is simpler because &lt;code&gt;range()&lt;/code&gt; handles the sequence generation for us. The &lt;code&gt;range()&lt;/code&gt; function can be used with three parameters: &lt;code&gt;range(start, stop, step).&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;start (optional): Specifies where the loop begins. Defaults to 0 if not provided.&lt;/li&gt;
&lt;li&gt;stop: Determines where the loop stops (exclusive).&lt;/li&gt;
&lt;li&gt;step (optional): Specifies the incrementation. Defaults to 1 if not provided.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reflection
&lt;/h2&gt;

&lt;p&gt;Staying accountable was a challenge. Balancing my responsibilities has been difficult as I’ve been juggling helping my dad with his business, assisting my mom with household chores, and making time for myself and my friends. At times, I felt overwhelmed trying to keep everything in order while still giving myself time to learn &lt;strong&gt;Python&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;To overcome these challenges, I’ve started developing schedules and experimenting with different planning methods to stay organized. I found paper planners work better for me than digital ones, as they help me stay focused and feel more confident. I also improved the way I take notes by using tools like Notion, which help me have clear and assessable notes. Additionally, having support from my instructors has been invaluable—they help keep me accountable and encourage me to stay on track despite the obstacles.&lt;/p&gt;

&lt;p&gt;These strategies haven’t made the challenges disappear, but they’ve helped me manage my time better and maintain progress in learning &lt;strong&gt;Python&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Throughout this guide, I've discussed the fundamentals of &lt;strong&gt;Python&lt;/strong&gt; and how it relates to &lt;strong&gt;JavaScript&lt;/strong&gt;. By studying variables, outputs, conditional statements, functions, and loops, I hope to give beginners a solid foundation for learning how to code in &lt;strong&gt;Python&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Several materials proved useful during my study path. I subscribed to BroCode's YouTube channel, which features short and simple videos. The 1-hour Python training and beginner-friendly project tutorials were especially helpful in practicing &lt;strong&gt;Python&lt;/strong&gt; concepts. In addition, I found Codecademy's Learn Python 3 course to be an amazing introduction to Python from scratch.&lt;/p&gt;

&lt;p&gt;Finally, developing a learning timetable helped me stay focused and accountable. By organizing my days, I was able to make progress while balancing my other responsibilities. I encourage you to find tools that work for you! Something I like to remind myself is every step counts, no matter how big or small.&lt;/p&gt;

&lt;p&gt;Great resources to check out :&lt;br&gt;
&lt;a href="https://www.codecademy.com/learn/learn-python-3" rel="noopener noreferrer"&gt;Learn Python3&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=8KCuHHeC_M0" rel="noopener noreferrer"&gt;YouTube (1 hour) tutorial&lt;/a&gt; &lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=4wGuB3oAKc4" rel="noopener noreferrer"&gt;YouTube tutorials on how to build small-scale projects:&lt;/a&gt;&lt;br&gt;
Creating a schedule&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good luck everyone&lt;/strong&gt;!&lt;/p&gt;

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