<?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: Kailas Warade</title>
    <description>The latest articles on DEV Community by Kailas Warade (@kailas_warade_d2a15d1ef8a).</description>
    <link>https://dev.to/kailas_warade_d2a15d1ef8a</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%2F4126500%2F91be8ee8-0234-427e-a917-f6338418cd5d.png</url>
      <title>DEV Community: Kailas Warade</title>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kailas_warade_d2a15d1ef8a"/>
    <language>en</language>
    <item>
      <title>SQL: Find the Top 2 Orders for Every Customer Using Window Functions</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Thu, 08 Oct 2026 03:26:32 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/sql-find-the-top-2-orders-for-every-customer-using-window-functions-1dnp</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/sql-find-the-top-2-orders-for-every-customer-using-window-functions-1dnp</guid>
      <description>&lt;p&gt;SQL: Find the Top 2 Orders for Every Customer Using Window Functions&lt;/p&gt;

&lt;p&gt;One SQL problem I often see people get wrong is:&lt;/p&gt;

&lt;p&gt;How do you find the top 2 orders for every customer?&lt;/p&gt;

&lt;p&gt;Finding the top 2 orders overall is easy.&lt;/p&gt;

&lt;p&gt;The interesting part is “for every customer.”&lt;/p&gt;

&lt;p&gt;Let’s take a simple example.&lt;/p&gt;

&lt;p&gt;Sample Data&lt;/p&gt;

&lt;p&gt;CID| OID| AMT&lt;br&gt;
C001| 1001| 12000&lt;br&gt;
C001| 1002| 7500&lt;br&gt;
C001| 1003| 9000&lt;br&gt;
C002| 1004| 15000&lt;br&gt;
C002| 1005| 6000&lt;br&gt;
C002| 1006| 11000&lt;br&gt;
C003| 1007| 5000&lt;br&gt;
C003| 1008| 18000&lt;br&gt;
C003| 1009| 12000&lt;/p&gt;

&lt;p&gt;We want the top 2 orders for each customer based on order amount.&lt;/p&gt;

&lt;p&gt;The expected result is:&lt;/p&gt;

&lt;p&gt;CID| OID| AMT&lt;br&gt;
C001| 1001| 12000&lt;br&gt;
C001| 1003| 9000&lt;br&gt;
C002| 1004| 15000&lt;br&gt;
C002| 1006| 11000&lt;br&gt;
C003| 1008| 18000&lt;br&gt;
C003| 1009| 12000&lt;/p&gt;

&lt;p&gt;Why a Simple ORDER BY Is Not Enough&lt;/p&gt;

&lt;p&gt;A common first attempt might be:&lt;/p&gt;

&lt;p&gt;SELECT *&lt;br&gt;
FROM orders&lt;br&gt;
ORDER BY amt DESC&lt;br&gt;
FETCH FIRST 2 ROWS ONLY;&lt;/p&gt;

&lt;p&gt;This returns the top 2 orders from the entire table.&lt;/p&gt;

&lt;p&gt;But that is not what we need.&lt;/p&gt;

&lt;p&gt;We need the ranking to start again for each customer.&lt;/p&gt;

&lt;p&gt;That is where SQL window functions become useful.&lt;/p&gt;

&lt;p&gt;If you want to learn more about window functions and analytic functions, I’ve also covered the topic in more detail here:&lt;/p&gt;

&lt;p&gt;SQL Window Functions / Analytic Functions&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sankalandtech.com/Tutorials/sql-plsql-faq-interview/window-functions-analytic-functions-sql-faq.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/sql-plsql-faq-interview/window-functions-analytic-functions-sql-faq.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using ROW_NUMBER()&lt;/p&gt;

&lt;p&gt;Here is the solution:&lt;/p&gt;

&lt;p&gt;SELECT cid,&lt;br&gt;
       oid,&lt;br&gt;
       amt&lt;br&gt;
FROM (&lt;br&gt;
    SELECT cid,&lt;br&gt;
           oid,&lt;br&gt;
           amt,&lt;br&gt;
           ROW_NUMBER() OVER (&lt;br&gt;
               PARTITION BY cid&lt;br&gt;
               ORDER BY amt DESC&lt;br&gt;
           ) AS rn&lt;br&gt;
    FROM orders&lt;br&gt;
)&lt;br&gt;
WHERE rn &amp;lt;= 2;&lt;/p&gt;

&lt;p&gt;The key part is:&lt;/p&gt;

&lt;p&gt;ROW_NUMBER() OVER (&lt;br&gt;
    PARTITION BY cid&lt;br&gt;
    ORDER BY amt DESC&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;What does it do?&lt;/p&gt;

&lt;p&gt;PARTITION BY cid&lt;/p&gt;

&lt;p&gt;Divides the data customer-wise.&lt;/p&gt;

&lt;p&gt;ORDER BY amt DESC&lt;/p&gt;

&lt;p&gt;Sorts each customer’s orders from highest amount to lowest.&lt;/p&gt;

&lt;p&gt;ROW_NUMBER()&lt;/p&gt;

&lt;p&gt;Assigns a sequence number to the orders within each customer.&lt;/p&gt;

&lt;p&gt;The result before applying "WHERE rn &amp;lt;= 2" looks like this:&lt;/p&gt;

&lt;p&gt;CID| OID| AMT| RN&lt;br&gt;
C001| 1001| 12000| 1&lt;br&gt;
C001| 1003| 9000| 2&lt;br&gt;
C001| 1002| 7500| 3&lt;br&gt;
C002| 1004| 15000| 1&lt;br&gt;
C002| 1006| 11000| 2&lt;br&gt;
C002| 1005| 6000| 3&lt;br&gt;
C003| 1008| 18000| 1&lt;br&gt;
C003| 1009| 12000| 2&lt;br&gt;
C003| 1007| 5000| 3&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;p&gt;WHERE rn &amp;lt;= 2&lt;/p&gt;

&lt;p&gt;keeps only the first two rows for each customer.&lt;/p&gt;

&lt;p&gt;What If Two Orders Have the Same Amount?&lt;/p&gt;

&lt;p&gt;This is where "ROW_NUMBER()", "RANK()", and "DENSE_RANK()" behave differently.&lt;/p&gt;

&lt;p&gt;ROW_NUMBER()&lt;/p&gt;

&lt;p&gt;Every row gets a unique number.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;OID| AMT| RN&lt;br&gt;
1001| 12000| 1&lt;br&gt;
1002| 12000| 2&lt;/p&gt;

&lt;p&gt;If you need exactly 2 rows per customer, "ROW_NUMBER()" is usually the right choice.&lt;/p&gt;

&lt;p&gt;RANK()&lt;/p&gt;

&lt;p&gt;Rows with the same amount receive the same rank.&lt;/p&gt;

&lt;p&gt;OID| AMT| RANK&lt;br&gt;
1001| 12000| 1&lt;br&gt;
1002| 12000| 1&lt;br&gt;
1003| 9000| 3&lt;/p&gt;

&lt;p&gt;Notice that rank 2 is skipped.&lt;/p&gt;

&lt;p&gt;DENSE_RANK()&lt;/p&gt;

&lt;p&gt;Rows with the same amount receive the same rank, but there are no gaps.&lt;/p&gt;

&lt;p&gt;OID| AMT| RANK&lt;br&gt;
1001| 12000| 1&lt;br&gt;
1002| 12000| 1&lt;br&gt;
1003| 9000| 2&lt;/p&gt;

&lt;p&gt;So the function you choose depends on the requirement.&lt;/p&gt;

&lt;p&gt;If you need:&lt;/p&gt;

&lt;p&gt;«Exactly 2 orders for every customer»&lt;/p&gt;

&lt;p&gt;use "ROW_NUMBER()".&lt;/p&gt;

&lt;p&gt;If you need:&lt;/p&gt;

&lt;p&gt;«All orders belonging to the top 2 amount levels»&lt;/p&gt;

&lt;p&gt;"DENSE_RANK()" may be a better choice.&lt;/p&gt;

&lt;p&gt;A Pattern Worth Remembering&lt;/p&gt;

&lt;p&gt;Whenever you see a requirement like:&lt;/p&gt;

&lt;p&gt;«Top N records for each customer, department, product, category, or region»&lt;/p&gt;

&lt;p&gt;think about this pattern:&lt;/p&gt;

&lt;p&gt;PARTITION BY&lt;br&gt;
+&lt;br&gt;
ORDER BY&lt;br&gt;
+&lt;br&gt;
ROW_NUMBER / RANK / DENSE_RANK&lt;/p&gt;

&lt;p&gt;The same approach can be used for many practical SQL problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Top 3 products for each category&lt;/li&gt;
&lt;li&gt;Highest-paid employees in each department&lt;/li&gt;
&lt;li&gt;Latest 2 transactions for each customer&lt;/li&gt;
&lt;li&gt;Top 5 sales for each region&lt;/li&gt;
&lt;li&gt;Most recent record for each employee&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The table and business requirement may change, but the underlying SQL pattern is often the same.&lt;/p&gt;

&lt;p&gt;Try This Yourself&lt;/p&gt;

&lt;p&gt;Now change the requirement:&lt;/p&gt;

&lt;p&gt;Find the latest 2 orders for every customer.&lt;/p&gt;

&lt;p&gt;What would you change in the query?&lt;/p&gt;

&lt;p&gt;The answer is in the "ORDER BY" inside the window function.&lt;/p&gt;

&lt;p&gt;That small change is worth understanding because learning the pattern is much more useful than simply memorizing one SQL query.&lt;/p&gt;




&lt;p&gt;Sankalan Data Tech&lt;br&gt;
Practical SQL, Python and Data Engineering learning.&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python Functions Explained: 10 Concepts Every Python Developer Should Know</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Wed, 07 Oct 2026 12:36:54 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-functions-explained-10-concepts-every-python-developer-should-know-239d</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-functions-explained-10-concepts-every-python-developer-should-know-239d</guid>
      <description>&lt;p&gt;If you are learning Python for Data Analytics, Data Engineering, automation, or backend development, functions are one of the first topics you need to get comfortable with.&lt;/p&gt;

&lt;p&gt;But in interviews, knowing only this is not enough:&lt;/p&gt;

&lt;p&gt;def add(a, b):&lt;br&gt;
    return a + b&lt;/p&gt;

&lt;p&gt;You may be asked what happens when you change the arguments, use "*args", pass keyword arguments, use default values, return multiple values, or access variables outside the function.&lt;/p&gt;

&lt;p&gt;Here are 10 Python function concepts worth understanding properly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Function Definition vs Function Call&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A function definition tells Python what the function should do.&lt;/p&gt;

&lt;p&gt;def calculate_total(price, quantity):&lt;br&gt;
    return price * quantity&lt;/p&gt;

&lt;p&gt;Nothing happens when Python reads the definition.&lt;/p&gt;

&lt;p&gt;The function runs when you call it:&lt;/p&gt;

&lt;p&gt;total = calculate_total(500, 3)&lt;/p&gt;

&lt;p&gt;print(total)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1500&lt;/p&gt;

&lt;p&gt;This distinction sounds basic, but it is a common interview question.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Parameters and Arguments Are Not the Same Thing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consider this function:&lt;/p&gt;

&lt;p&gt;def calculate_total(price, quantity):&lt;br&gt;
    return price * quantity&lt;/p&gt;

&lt;p&gt;Here, "price" and "quantity" are parameters.&lt;/p&gt;

&lt;p&gt;When we call:&lt;/p&gt;

&lt;p&gt;calculate_total(500, 3)&lt;/p&gt;

&lt;p&gt;"500" and "3" are arguments.&lt;/p&gt;

&lt;p&gt;A simple way to remember it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parameter → variable written in the function definition&lt;/li&gt;
&lt;li&gt;Argument → actual value passed during the function call&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This becomes more important when you start working with different types of arguments.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Positional and Keyword Arguments&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With positional arguments, Python matches values based on their position.&lt;/p&gt;

&lt;p&gt;def create_user(name, age):&lt;br&gt;
    print(name, age)&lt;/p&gt;

&lt;p&gt;create_user("Rahul", 28)&lt;/p&gt;

&lt;p&gt;Here:&lt;/p&gt;

&lt;p&gt;name = Rahul&lt;br&gt;
age  = 28&lt;/p&gt;

&lt;p&gt;With keyword arguments, you explicitly mention the parameter name:&lt;/p&gt;

&lt;p&gt;create_user(age=28, name="Rahul")&lt;/p&gt;

&lt;p&gt;This can make function calls easier to read, especially when a function has several parameters.&lt;/p&gt;

&lt;p&gt;You can also mix them:&lt;/p&gt;

&lt;p&gt;create_user("Rahul", age=28)&lt;/p&gt;

&lt;p&gt;This is valid because the positional argument comes before the keyword argument.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Default Arguments Make Functions More Flexible&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Suppose most users are from India:&lt;/p&gt;

&lt;p&gt;def create_user(name, country="India"):&lt;br&gt;
    print(name, country)&lt;/p&gt;

&lt;p&gt;Now you can call:&lt;/p&gt;

&lt;p&gt;create_user("Rahul")&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Rahul India&lt;/p&gt;

&lt;p&gt;Or override the default:&lt;/p&gt;

&lt;p&gt;create_user("John", "USA")&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;John USA&lt;/p&gt;

&lt;p&gt;Default arguments are useful when a parameter has a sensible value that will be used most of the time.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;What Exactly Does "*args" Do?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sometimes you don't know how many positional values will be passed.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;def calculate_sum(*args):&lt;br&gt;
    return sum(args)&lt;/p&gt;

&lt;p&gt;print(calculate_sum(10, 20))&lt;br&gt;
print(calculate_sum(10, 20, 30, 40))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;30&lt;br&gt;
100&lt;/p&gt;

&lt;p&gt;Inside the function, "args" is a tuple.&lt;/p&gt;

&lt;p&gt;def show_values(*args):&lt;br&gt;
    print(args)&lt;/p&gt;

&lt;p&gt;show_values(10, 20, 30)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;(10, 20, 30)&lt;/p&gt;

&lt;p&gt;The important point is that "*" tells Python to collect additional positional arguments.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;What About "**kwargs"?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"**kwargs" is used when you want to accept multiple keyword arguments.&lt;/p&gt;

&lt;p&gt;def show_user(**kwargs):&lt;br&gt;
    print(kwargs)&lt;/p&gt;

&lt;p&gt;show_user(&lt;br&gt;
    name="Rahul",&lt;br&gt;
    age=28,&lt;br&gt;
    city="Pune"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;{'name': 'Rahul', 'age': 28, 'city': 'Pune'}&lt;/p&gt;

&lt;p&gt;Inside the function, "kwargs" is a dictionary.&lt;/p&gt;

&lt;p&gt;This can be useful when the function needs to accept flexible named inputs.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;def create_report(**filters):&lt;br&gt;
    for key, value in filters.items():&lt;br&gt;
        print(key, value)&lt;/p&gt;

&lt;p&gt;create_report(&lt;br&gt;
    city="Pune",&lt;br&gt;
    department="Sales",&lt;br&gt;
    year=2026&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;The names "args" and "kwargs" are conventional. Python does not require those exact names.&lt;/p&gt;

&lt;p&gt;For example, this also works:&lt;/p&gt;

&lt;p&gt;def show_values(*values):&lt;br&gt;
    print(values)&lt;/p&gt;

&lt;p&gt;And:&lt;/p&gt;

&lt;p&gt;def show_details(**details):&lt;br&gt;
    print(details)&lt;/p&gt;

&lt;p&gt;The "&lt;em&gt;" and "&lt;/em&gt;*" are what matter.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;"return" Is Different From "print()"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is an important concept for beginners.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;def add(a, b):&lt;br&gt;
    print(a + b)&lt;/p&gt;

&lt;p&gt;The function displays the result, but it does not return the result.&lt;/p&gt;

&lt;p&gt;Now compare it with:&lt;/p&gt;

&lt;p&gt;def add(a, b):&lt;br&gt;
    return a + b&lt;/p&gt;

&lt;p&gt;You can store the returned value:&lt;/p&gt;

&lt;p&gt;result = add(10, 20)&lt;/p&gt;

&lt;p&gt;print(result)&lt;/p&gt;

&lt;p&gt;This matters when functions are combined.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;def calculate_discount(price, discount):&lt;br&gt;
    return price - (price * discount / 100)&lt;/p&gt;

&lt;p&gt;final_price = calculate_discount(1000, 10)&lt;/p&gt;

&lt;p&gt;print(final_price)&lt;/p&gt;

&lt;p&gt;The returned value can be stored, passed to another function, or used in a larger calculation.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Can a Python Function Return Multiple Values?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;def get_employee():&lt;br&gt;
    return "Rahul", "Data Engineer", 85000&lt;/p&gt;

&lt;p&gt;You can receive the result like this:&lt;/p&gt;

&lt;p&gt;name, role, salary = get_employee()&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(role)&lt;br&gt;
print(salary)&lt;/p&gt;

&lt;p&gt;Python actually returns these values as a tuple.&lt;/p&gt;

&lt;p&gt;You can see this directly:&lt;/p&gt;

&lt;p&gt;result = get_employee()&lt;/p&gt;

&lt;p&gt;print(result)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;('Rahul', 'Data Engineer', 85000)&lt;/p&gt;

&lt;p&gt;This is useful when a function needs to return a small group of related values.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Understand Local and Global Variables&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;/p&gt;

&lt;p&gt;def show_name():&lt;br&gt;
    print(name)&lt;/p&gt;

&lt;p&gt;show_name()&lt;/p&gt;

&lt;p&gt;The function can read the global variable.&lt;/p&gt;

&lt;p&gt;But a variable created inside a function normally belongs to that function:&lt;/p&gt;

&lt;p&gt;def show_name():&lt;br&gt;
    name = "Rahul"&lt;br&gt;
    print(name)&lt;/p&gt;

&lt;p&gt;show_name()&lt;/p&gt;

&lt;h1&gt;
  
  
  print(name)  # NameError
&lt;/h1&gt;

&lt;p&gt;The variable "name" created inside the function is local to that function.&lt;/p&gt;

&lt;p&gt;You may also see the "global" keyword:&lt;/p&gt;

&lt;p&gt;count = 0&lt;/p&gt;

&lt;p&gt;def increase():&lt;br&gt;
    global count&lt;br&gt;
    count += 1&lt;/p&gt;

&lt;p&gt;increase()&lt;/p&gt;

&lt;p&gt;print(count)&lt;/p&gt;

&lt;p&gt;Although "global" is valid, changing global state inside functions should generally be done carefully because it can make code harder to understand and test.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;One Interview Question That Tests Your Understanding&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What will this code print?&lt;/p&gt;

&lt;p&gt;def calculate(a, b=10):&lt;br&gt;
    return a + b&lt;/p&gt;

&lt;p&gt;print(calculate(5))&lt;br&gt;
print(calculate(5, 20))&lt;/p&gt;

&lt;p&gt;The answer is:&lt;/p&gt;

&lt;p&gt;15&lt;br&gt;
25&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;In the first call:&lt;/p&gt;

&lt;p&gt;calculate(5)&lt;/p&gt;

&lt;p&gt;Python uses the default value:&lt;/p&gt;

&lt;p&gt;a = 5&lt;br&gt;
b = 10&lt;/p&gt;

&lt;p&gt;In the second call:&lt;/p&gt;

&lt;p&gt;calculate(5, 20)&lt;/p&gt;

&lt;p&gt;The supplied value "20" replaces the default.&lt;/p&gt;

&lt;p&gt;Questions like this are more useful than simply memorizing the definition of a function.&lt;/p&gt;




&lt;p&gt;What Should You Prepare for a Python Interview?&lt;/p&gt;

&lt;p&gt;For functions, don't stop at the basic syntax.&lt;/p&gt;

&lt;p&gt;Make sure you can explain and write examples for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Function definition and function call&lt;/li&gt;
&lt;li&gt;Parameters vs arguments&lt;/li&gt;
&lt;li&gt;Positional arguments&lt;/li&gt;
&lt;li&gt;Keyword arguments&lt;/li&gt;
&lt;li&gt;Default arguments&lt;/li&gt;
&lt;li&gt;"*args"&lt;/li&gt;
&lt;li&gt;"**kwargs"&lt;/li&gt;
&lt;li&gt;"return" vs "print"&lt;/li&gt;
&lt;li&gt;Returning multiple values&lt;/li&gt;
&lt;li&gt;Local and global scope&lt;/li&gt;
&lt;li&gt;"global" keyword&lt;/li&gt;
&lt;li&gt;Lambda functions&lt;/li&gt;
&lt;li&gt;Nested functions&lt;/li&gt;
&lt;li&gt;Recursion&lt;/li&gt;
&lt;li&gt;Decorators&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The important part is not just remembering the definition.&lt;/p&gt;

&lt;p&gt;Write the code, run it, change the input, and see what Python actually does.&lt;/p&gt;

&lt;p&gt;That is how these concepts become much easier to remember during an interview.&lt;/p&gt;

&lt;p&gt;More Python Function Interview Questions&lt;/p&gt;

&lt;p&gt;If you want a more detailed interview-focused reference, I have covered Python functions with examples and explanations here:&lt;/p&gt;

&lt;p&gt;👉 "Python Functions Interview Questions and Answers" (&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-functions-tutorial.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-functions-tutorial.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;The page goes deeper into Python function concepts and can be useful as a revision page before a Python interview.&lt;/p&gt;

&lt;p&gt;Final Thought&lt;/p&gt;

&lt;p&gt;Functions look simple when you first learn Python.&lt;/p&gt;

&lt;p&gt;But once you understand how arguments, return values, scope, "&lt;em&gt;args", "&lt;/em&gt;*kwargs", and nested functions work, you start writing much more reusable Python code.&lt;/p&gt;

&lt;p&gt;And that is the real purpose of learning functions — not just answering an interview question, but being able to break a real problem into smaller pieces of code that you can reuse and test.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>interview</category>
      <category>coding</category>
    </item>
    <item>
      <title>Python Loops and Flow Control: A Practical Guide to Repetition and Program Execution</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Mon, 05 Oct 2026 01:36:55 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-loops-and-flow-control-a-practical-guide-to-repetition-and-program-execution-110p</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-loops-and-flow-control-a-practical-guide-to-repetition-and-program-execution-110p</guid>
      <description>&lt;p&gt;When writing Python programs, we often need to execute the same operation repeatedly.&lt;/p&gt;

&lt;p&gt;It could be processing records, checking values in a list, reading a file line by line, processing API responses, or performing repetitive data-processing tasks.&lt;/p&gt;

&lt;p&gt;Writing the same code again and again is not practical.&lt;/p&gt;

&lt;p&gt;This is where loops and flow control become important.&lt;/p&gt;

&lt;p&gt;Python provides simple ways to repeat operations, make decisions, skip specific iterations, stop execution when required, and control the normal flow of a program.&lt;/p&gt;

&lt;p&gt;In this post, we'll understand the important concepts behind Python loops and flow control with practical examples.&lt;/p&gt;




&lt;p&gt;*&lt;em&gt;What Is a Loop in Python?&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
A loop allows us to execute a block of code repeatedly.&lt;/p&gt;

&lt;p&gt;For example, if we want to print numbers from 1 to 5, we could write:&lt;/p&gt;

&lt;p&gt;print(1)&lt;br&gt;
print(2)&lt;br&gt;
print(3)&lt;br&gt;
print(4)&lt;br&gt;
print(5)&lt;/p&gt;

&lt;p&gt;But using a loop makes the code much simpler:&lt;/p&gt;

&lt;p&gt;for i in range(1, 6):&lt;br&gt;
    print(i)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;/p&gt;

&lt;p&gt;The main advantage of loops is that they reduce repetitive code.&lt;/p&gt;

&lt;p&gt;Loops are commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Processing lists&lt;/li&gt;
&lt;li&gt;Processing strings&lt;/li&gt;
&lt;li&gt;Reading files&lt;/li&gt;
&lt;li&gt;Processing database records&lt;/li&gt;
&lt;li&gt;Handling API responses&lt;/li&gt;
&lt;li&gt;Data transformation&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Data analysis&lt;/li&gt;
&lt;li&gt;ETL and data-processing tasks&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;The Two Main Types of Loops in Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python mainly provides two types of loops:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"for" loop&lt;/li&gt;
&lt;li&gt;"while" loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They both repeat code, but they are generally used in different situations.&lt;/p&gt;




&lt;p&gt;for Loop&lt;/p&gt;

&lt;p&gt;A "for" loop is commonly used to iterate through an iterable.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;fruits = ["Apple", "Banana", "Mango"]&lt;/p&gt;

&lt;p&gt;for fruit in fruits:&lt;br&gt;
    print(fruit)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Apple&lt;br&gt;
Banana&lt;br&gt;
Mango&lt;/p&gt;

&lt;p&gt;The loop takes one item at a time from the collection.&lt;/p&gt;

&lt;p&gt;A "for" loop can be used with lists, strings, tuples, ranges, and many other iterable objects.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;name = "Python"&lt;/p&gt;

&lt;p&gt;for character in name:&lt;br&gt;
    print(character)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;P&lt;br&gt;
y&lt;br&gt;
t&lt;br&gt;
h&lt;br&gt;
o&lt;br&gt;
n&lt;/p&gt;




&lt;p&gt;while Loop&lt;/p&gt;

&lt;p&gt;A "while" loop continues executing as long as its condition is true.&lt;/p&gt;

&lt;p&gt;count = 1&lt;/p&gt;

&lt;p&gt;while count &amp;lt;= 5:&lt;br&gt;
    print(count)&lt;br&gt;
    count += 1&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;/p&gt;

&lt;p&gt;The important part here is:&lt;/p&gt;

&lt;p&gt;count += 1&lt;/p&gt;

&lt;p&gt;The value changes during each iteration.&lt;/p&gt;

&lt;p&gt;Eventually, "count &amp;lt;= 5" becomes false and the loop stops.&lt;/p&gt;

&lt;p&gt;A "while" loop is useful when the number of iterations depends on a condition that can change during execution.&lt;/p&gt;




&lt;p&gt;for vs while&lt;/p&gt;

&lt;p&gt;A simple way to think about them is:&lt;/p&gt;

&lt;p&gt;for loop&lt;/p&gt;

&lt;p&gt;Use it when you are iterating through a sequence or iterable.&lt;/p&gt;

&lt;p&gt;for item in items:&lt;br&gt;
    print(item)&lt;/p&gt;

&lt;p&gt;while loop&lt;/p&gt;

&lt;p&gt;Use it when a condition controls whether the loop should continue.&lt;/p&gt;

&lt;p&gt;while condition:&lt;br&gt;
    # code&lt;/p&gt;

&lt;p&gt;The choice should depend on the problem rather than simply on whether the number of iterations is known.&lt;/p&gt;




&lt;p&gt;What Is an Iterable?&lt;/p&gt;

&lt;p&gt;An iterable is an object whose values can be accessed one at a time.&lt;/p&gt;

&lt;p&gt;Common examples include:&lt;/p&gt;

&lt;p&gt;list&lt;br&gt;
tuple&lt;br&gt;
string&lt;br&gt;
set&lt;br&gt;
dictionary&lt;br&gt;
range&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30]&lt;/p&gt;

&lt;p&gt;for number in numbers:&lt;br&gt;
    print(number)&lt;/p&gt;

&lt;p&gt;The "for" loop gets each value from the iterable.&lt;/p&gt;

&lt;p&gt;Understanding iterables is important because Python's "for" loop is built around iteration.&lt;/p&gt;




&lt;p&gt;Using range()&lt;/p&gt;

&lt;p&gt;The "range()" function is commonly used with "for" loops.&lt;/p&gt;

&lt;p&gt;There are three common forms:&lt;/p&gt;

&lt;p&gt;range(stop)&lt;/p&gt;

&lt;p&gt;range(start, stop)&lt;/p&gt;

&lt;p&gt;range(start, stop, step)&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;for i in range(5):&lt;br&gt;
    print(i)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

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

&lt;p&gt;Notice that "5" is not included.&lt;/p&gt;

&lt;p&gt;We can specify a starting value:&lt;/p&gt;

&lt;p&gt;for i in range(1, 6):&lt;br&gt;
    print(i)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;/p&gt;

&lt;p&gt;We can also specify a step:&lt;/p&gt;

&lt;p&gt;for i in range(0, 11, 2):&lt;br&gt;
    print(i)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;0&lt;br&gt;
2&lt;br&gt;
4&lt;br&gt;
6&lt;br&gt;
8&lt;br&gt;
10&lt;/p&gt;

&lt;p&gt;The "step" controls how much the value changes during each iteration.&lt;/p&gt;




&lt;p&gt;Loop Control Variables&lt;/p&gt;

&lt;p&gt;A loop control variable can be used to control how long a loop continues.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;count = 1&lt;/p&gt;

&lt;p&gt;while count &amp;lt;= 5:&lt;br&gt;
    print(count)&lt;br&gt;
    count += 1&lt;/p&gt;

&lt;p&gt;Here, "count" starts at "1" and increases after every iteration.&lt;/p&gt;

&lt;p&gt;When it reaches "6", the condition becomes false.&lt;/p&gt;

&lt;p&gt;This is especially important when working with "while" loops.&lt;/p&gt;




&lt;p&gt;Infinite Loops&lt;/p&gt;

&lt;p&gt;An infinite loop is a loop that never reaches a condition that stops it.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;while True:&lt;br&gt;
    print("Running...")&lt;/p&gt;

&lt;p&gt;Because the condition is always "True", the loop continues indefinitely.&lt;/p&gt;

&lt;p&gt;An infinite loop can also happen accidentally:&lt;/p&gt;

&lt;p&gt;count = 1&lt;/p&gt;

&lt;p&gt;while count &amp;lt;= 5:&lt;br&gt;
    print(count)&lt;/p&gt;

&lt;p&gt;The problem is that "count" never changes.&lt;/p&gt;

&lt;p&gt;A corrected version is:&lt;/p&gt;

&lt;p&gt;count = 1&lt;/p&gt;

&lt;p&gt;while count &amp;lt;= 5:&lt;br&gt;
    print(count)&lt;br&gt;
    count += 1&lt;/p&gt;

&lt;p&gt;Whenever you write a "while" loop, ask:&lt;/p&gt;

&lt;p&gt;What will eventually make this condition false?&lt;/p&gt;




&lt;p&gt;break, continue and pass&lt;/p&gt;

&lt;p&gt;Python provides three important statements for controlling loop execution:&lt;/p&gt;

&lt;p&gt;break&lt;br&gt;
continue&lt;br&gt;
pass&lt;/p&gt;

&lt;p&gt;They have completely different purposes.&lt;/p&gt;

&lt;p&gt;break&lt;/p&gt;

&lt;p&gt;"break" stops the entire loop.&lt;/p&gt;

&lt;p&gt;for i in range(1, 6):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if i == 3:
    break

print(i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;/p&gt;

&lt;p&gt;When "i" becomes "3", the loop terminates.&lt;/p&gt;

&lt;p&gt;This is useful when the required result has already been found and there is no reason to continue.&lt;/p&gt;

&lt;p&gt;continue&lt;/p&gt;

&lt;p&gt;"continue" skips the current iteration.&lt;/p&gt;

&lt;p&gt;for i in range(1, 6):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if i == 3:
    continue

print(i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
4&lt;br&gt;
5&lt;/p&gt;

&lt;p&gt;The loop continues after skipping "3".&lt;/p&gt;

&lt;p&gt;pass&lt;/p&gt;

&lt;p&gt;"pass" does nothing.&lt;/p&gt;

&lt;p&gt;for i in range(5):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if i == 2:
    pass

print(i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:&lt;/p&gt;

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

&lt;p&gt;So the easiest way to remember them is:&lt;/p&gt;

&lt;p&gt;break     → stop the loop&lt;br&gt;
continue  → skip the current iteration&lt;br&gt;
pass      → do nothing&lt;/p&gt;




&lt;p&gt;Nested Loops&lt;/p&gt;

&lt;p&gt;A loop inside another loop is called a nested loop.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;for i in range(1, 4):&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;The inner loop executes completely for each iteration of the outer loop.&lt;/p&gt;

&lt;p&gt;Nested loops are useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tables&lt;/li&gt;
&lt;li&gt;Grids&lt;/li&gt;
&lt;li&gt;Matrices&lt;/li&gt;
&lt;li&gt;Multi-dimensional data&lt;/li&gt;
&lt;li&gt;Combinations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, they can become expensive when working with large datasets, so unnecessary nested loops should be avoided.&lt;/p&gt;




&lt;p&gt;enumerate()&lt;/p&gt;

&lt;p&gt;Sometimes we need both the position and the value while iterating.&lt;/p&gt;

&lt;p&gt;Python provides "enumerate()" for this purpose.&lt;/p&gt;

&lt;p&gt;fruits = ["Apple", "Banana", "Mango"]&lt;/p&gt;

&lt;p&gt;for index, fruit in enumerate(fruits):&lt;br&gt;
    print(index, fruit)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;0 Apple&lt;br&gt;
1 Banana&lt;br&gt;
2 Mango&lt;/p&gt;

&lt;p&gt;This is cleaner than maintaining a separate counter.&lt;/p&gt;




&lt;p&gt;Loop else&lt;/p&gt;

&lt;p&gt;Python has an interesting feature that allows an "else" block to be used with loops.&lt;/p&gt;

&lt;p&gt;The loop "else" executes when the loop finishes normally without "break".&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;for i in range(5):&lt;br&gt;
    print(i)&lt;br&gt;
else:&lt;br&gt;
    print("Loop completed")&lt;/p&gt;

&lt;p&gt;The "else" block executes because the loop finishes normally.&lt;/p&gt;

&lt;p&gt;But if "break" terminates the loop:&lt;/p&gt;

&lt;p&gt;for i in range(5):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if i == 3:
    break

print(i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;else:&lt;br&gt;
    print("Loop completed")&lt;/p&gt;

&lt;p&gt;The "else" block does not execute.&lt;/p&gt;

&lt;p&gt;A useful way to remember it is:&lt;/p&gt;

&lt;p&gt;Loop "else" runs when the loop completes without "break".&lt;/p&gt;




&lt;p&gt;Simulating a do-while Loop&lt;/p&gt;

&lt;p&gt;Python does not have a separate "do-while" statement.&lt;/p&gt;

&lt;p&gt;However, similar behavior can be created using "while True" and "break".&lt;/p&gt;

&lt;p&gt;while True:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;value = input("Enter a positive number: ")

if int(value) &amp;gt; 0:
    break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The body executes first, and the loop can then be terminated when the required condition is satisfied.&lt;/p&gt;

&lt;p&gt;This is useful when an operation needs to execute at least once before checking whether the loop should continue.&lt;/p&gt;




&lt;p&gt;Iterating in Reverse&lt;/p&gt;

&lt;p&gt;The "range()" function can also be used to iterate backwards.&lt;/p&gt;

&lt;p&gt;for number in range(10, 0, -1):&lt;br&gt;
    print(number)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;10&lt;br&gt;
9&lt;br&gt;
8&lt;br&gt;
7&lt;br&gt;
6&lt;br&gt;
5&lt;br&gt;
4&lt;br&gt;
3&lt;br&gt;
2&lt;br&gt;
1&lt;/p&gt;

&lt;p&gt;The "-1" tells Python to decrease the value after every iteration.&lt;/p&gt;




&lt;p&gt;Printing Every Other Number&lt;/p&gt;

&lt;p&gt;The "step" argument of "range()" can be used to skip values.&lt;/p&gt;

&lt;p&gt;for number in range(0, 11, 2):&lt;br&gt;
    print(number)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;0&lt;br&gt;
2&lt;br&gt;
4&lt;br&gt;
6&lt;br&gt;
8&lt;br&gt;
10&lt;/p&gt;

&lt;p&gt;The value increases by "2" each time.&lt;/p&gt;




&lt;p&gt;Handling Exceptions Inside a Loop&lt;/p&gt;

&lt;p&gt;When processing many values, one invalid value should not always stop the complete operation.&lt;/p&gt;

&lt;p&gt;Python allows us to handle exceptions inside a loop.&lt;/p&gt;

&lt;p&gt;numbers = [10, 5, 0, 3]&lt;/p&gt;

&lt;p&gt;for number in numbers:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    result = 100 / number
    print(result)

except ZeroDivisionError:
    print("Cannot divide by zero")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When the value is "0", the exception is handled and the loop continues.&lt;/p&gt;

&lt;p&gt;This pattern is useful when processing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data records&lt;/li&gt;
&lt;li&gt;Files&lt;/li&gt;
&lt;li&gt;API responses&lt;/li&gt;
&lt;li&gt;User input&lt;/li&gt;
&lt;li&gt;Large datasets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It makes the program more robust because one problematic record does not necessarily stop the complete process.&lt;/p&gt;




&lt;p&gt;How to Write Better Python Loops&lt;/p&gt;

&lt;p&gt;Once the logic is correct, we can also think about readability and performance.&lt;/p&gt;

&lt;p&gt;Use built-in functions&lt;/p&gt;

&lt;p&gt;For some operations, Python's built-in functions can replace manual loops.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;total = sum(numbers)&lt;/p&gt;

&lt;p&gt;Other useful functions include:&lt;/p&gt;

&lt;p&gt;min(numbers)&lt;br&gt;
max(numbers)&lt;/p&gt;

&lt;p&gt;Avoid unnecessary calculations&lt;/p&gt;

&lt;p&gt;If a calculation does not change during the loop, perform it outside the loop when possible.&lt;/p&gt;

&lt;p&gt;Avoid unnecessary nested loops&lt;/p&gt;

&lt;p&gt;Nested loops can become expensive as the amount of data increases.&lt;/p&gt;

&lt;p&gt;Use appropriate data structures&lt;/p&gt;

&lt;p&gt;Sets and dictionaries can be useful for efficient lookup operations.&lt;/p&gt;

&lt;p&gt;Stop processing when the answer is known&lt;/p&gt;

&lt;p&gt;Use "break" when there is no reason to continue.&lt;/p&gt;

&lt;p&gt;Consider vectorized operations for data processing&lt;/p&gt;

&lt;p&gt;When working with libraries such as Pandas and NumPy, a Python loop is not always the best solution. Vectorized operations can often be more appropriate for large datasets.&lt;/p&gt;




&lt;p&gt;Why Loops Matter in Data Engineering and Data Analytics&lt;/p&gt;

&lt;p&gt;Loops are basic Python concepts, but they appear in many real-world tasks.&lt;/p&gt;

&lt;p&gt;For example, they can be used while:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Processing records&lt;/li&gt;
&lt;li&gt;Validating data&lt;/li&gt;
&lt;li&gt;Transforming values&lt;/li&gt;
&lt;li&gt;Reading files&lt;/li&gt;
&lt;li&gt;Calling APIs&lt;/li&gt;
&lt;li&gt;Handling errors&lt;/li&gt;
&lt;li&gt;Automating repetitive operations&lt;/li&gt;
&lt;li&gt;Building data-processing scripts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As your Python knowledge grows, you will also learn when not to use a loop.&lt;/p&gt;

&lt;p&gt;For example, Pandas and NumPy provide operations that can process collections of data more efficiently than manually iterating through every row in many situations.&lt;/p&gt;

&lt;p&gt;So the goal is not simply to learn loop syntax.&lt;/p&gt;

&lt;p&gt;The goal is to understand how and when to control program execution effectively.&lt;/p&gt;




&lt;p&gt;Going Deeper: Python Loops and Flow Control&lt;/p&gt;

&lt;p&gt;The examples above give you the foundation.&lt;/p&gt;

&lt;p&gt;But if you are preparing for technical interviews or want to understand the topic more deeply, there are many details worth exploring—such as iterable behavior, loop termination, "range()", "enumerate()", nested loops, loop "else", "break" and "continue", do-while behavior, optimization, and exception handling.&lt;/p&gt;

&lt;p&gt;I have put those deeper topics into a separate 25-question Python Loops and Flow Control technical Q&amp;amp;A resource, with detailed explanations and examples.&lt;/p&gt;

&lt;p&gt;👉 "Explore the detailed Python Loops and Flow Control questions and answers" (&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-control-structures-loops.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-control-structures-loops.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;You can use this post to understand the concepts first, and then use the detailed Q&amp;amp;A resource when you want to test your understanding or go deeper into the technical side of Python loops.&lt;/p&gt;




&lt;p&gt;Final Takeaway&lt;/p&gt;

&lt;p&gt;Python loops are more than just a way to repeat code.&lt;/p&gt;

&lt;p&gt;They are a fundamental part of controlling program execution.&lt;/p&gt;

&lt;p&gt;The important concepts to remember are:&lt;/p&gt;

&lt;p&gt;for        → iterate over an iterable&lt;br&gt;
while      → repeat while a condition is true&lt;br&gt;
range()    → generate a sequence of numbers&lt;br&gt;
enumerate  → get index and value&lt;br&gt;
break      → stop the loop&lt;br&gt;
continue   → skip the current iteration&lt;br&gt;
pass       → do nothing&lt;br&gt;
nested loop → loop inside another loop&lt;br&gt;
loop else  → execute when the loop completes normally&lt;/p&gt;

&lt;p&gt;Start with small examples.&lt;/p&gt;

&lt;p&gt;Run the code.&lt;/p&gt;

&lt;p&gt;Change the conditions.&lt;/p&gt;

&lt;p&gt;Predict the output.&lt;/p&gt;

&lt;p&gt;Then move to real-world data-processing problems.&lt;/p&gt;

&lt;p&gt;That is where Python loops and flow control become much more useful.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Python if-else: A Simple Guide with Examples</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Thu, 01 Oct 2026 03:19:23 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-if-else-a-simple-guide-with-examples-6km</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-if-else-a-simple-guide-with-examples-6km</guid>
      <description>&lt;p&gt;Python if-else: A Simple Guide with Examples&lt;/p&gt;

&lt;p&gt;Programs often need to make decisions.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the temperature is high, show a warning.&lt;/li&gt;
&lt;li&gt;If a file exists, read it.&lt;/li&gt;
&lt;li&gt;If marks are above 40, consider the student passed.&lt;/li&gt;
&lt;li&gt;If a value is missing, handle it differently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python uses "if", "elif", and "else" to handle this kind of logic.&lt;/p&gt;

&lt;p&gt;These are simple statements, but you will use them regularly when writing Python programs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python if statement&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's start with a simple example.&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
    print("Adult")&lt;/p&gt;

&lt;p&gt;The condition "age &amp;gt;= 18" is checked first.&lt;/p&gt;

&lt;p&gt;If it is "True", Python runs the indented code below it.&lt;/p&gt;

&lt;p&gt;If it is "False", Python skips that code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python if-else&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sometimes we have two possible results.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;marks = 65&lt;/p&gt;

&lt;p&gt;if marks &amp;gt;= 40:&lt;br&gt;
    print("Pass")&lt;br&gt;
else:&lt;br&gt;
    print("Fail")&lt;/p&gt;

&lt;p&gt;Here, Python does one of two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"marks &amp;gt;= 40" is true → "Pass"&lt;/li&gt;
&lt;li&gt;"marks &amp;gt;= 40" is false → "Fail"&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Python if-elif-else&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What if there are several possible results?&lt;/p&gt;

&lt;p&gt;We can use "elif".&lt;/p&gt;

&lt;p&gt;marks = 78&lt;/p&gt;

&lt;p&gt;if marks &amp;gt;= 75:&lt;br&gt;
    print("Distinction")&lt;br&gt;
elif marks &amp;gt;= 60:&lt;br&gt;
    print("First Class")&lt;br&gt;
elif marks &amp;gt;= 40:&lt;br&gt;
    print("Pass")&lt;br&gt;
else:&lt;br&gt;
    print("Fail")&lt;/p&gt;

&lt;p&gt;Python checks the conditions from top to bottom.&lt;/p&gt;

&lt;p&gt;For "marks = 78", the first condition is true, so Python prints:&lt;/p&gt;

&lt;p&gt;Distinction&lt;/p&gt;

&lt;p&gt;It does not continue checking the remaining "elif" conditions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multiple if statements vs if-elif-else&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is an important difference.&lt;/p&gt;

&lt;p&gt;With separate "if" statements:&lt;/p&gt;

&lt;p&gt;num = 10&lt;/p&gt;

&lt;p&gt;if num &amp;gt; 0:&lt;br&gt;
    print("Positive")&lt;/p&gt;

&lt;p&gt;if num &amp;gt; 5:&lt;br&gt;
    print("Greater than 5")&lt;/p&gt;

&lt;p&gt;Both conditions are checked independently.&lt;/p&gt;

&lt;p&gt;With "if-elif":&lt;/p&gt;

&lt;p&gt;num = 10&lt;/p&gt;

&lt;p&gt;if num &amp;gt; 0:&lt;br&gt;
    print("Positive")&lt;br&gt;
elif num &amp;gt; 5:&lt;br&gt;
    print("Greater than 5")&lt;/p&gt;

&lt;p&gt;Once the first condition is true, Python skips the "elif".&lt;/p&gt;

&lt;p&gt;A simple way to remember this:&lt;/p&gt;

&lt;p&gt;Separate "if" statements are independent.&lt;/p&gt;

&lt;p&gt;"if-elif-else" is one chain of conditions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using "and"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can combine conditions with logical operators.&lt;/p&gt;

&lt;p&gt;With "and", all conditions must be true.&lt;/p&gt;

&lt;p&gt;age = 25&lt;br&gt;
salary = 50000&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18 and salary &amp;gt;= 30000:&lt;br&gt;
    print("Eligible")&lt;/p&gt;

&lt;p&gt;Both conditions need to be "True" for the message to be printed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using "or"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With "or", at least one condition needs to be true.&lt;/p&gt;

&lt;p&gt;day = "Saturday"&lt;/p&gt;

&lt;p&gt;if day == "Saturday" or day == "Sunday":&lt;br&gt;
    print("Weekend")&lt;/p&gt;

&lt;p&gt;The condition is true because "day == "Saturday"" is true.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using "not"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"not" reverses a Boolean condition.&lt;/p&gt;

&lt;p&gt;is_active = False&lt;/p&gt;

&lt;p&gt;if not is_active:&lt;br&gt;
    print("Account is inactive")&lt;/p&gt;

&lt;p&gt;Since "is_active" is "False", "not is_active" is "True".&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Nested if&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An "if" statement can be placed inside another "if".&lt;/p&gt;

&lt;p&gt;age = 25&lt;br&gt;
has_id = True&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
    if has_id:&lt;br&gt;
        print("Access allowed")&lt;/p&gt;

&lt;p&gt;This is called a nested "if".&lt;/p&gt;

&lt;p&gt;Nested conditions are sometimes useful, but too many levels of nesting can make code difficult to read.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python conditional expression&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a simple two-way decision, Python provides a conditional expression.&lt;/p&gt;

&lt;p&gt;age = 20&lt;/p&gt;

&lt;p&gt;result = "Adult" if age &amp;gt;= 18 else "Minor"&lt;/p&gt;

&lt;p&gt;print(result)&lt;/p&gt;

&lt;p&gt;This is often called a ternary expression.&lt;/p&gt;

&lt;p&gt;It can make short conditions more compact.&lt;/p&gt;

&lt;p&gt;For complicated logic, however, a normal "if-else" statement is usually easier to understand.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checking positive, negative, or zero&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is another simple example:&lt;/p&gt;

&lt;p&gt;num = -5&lt;/p&gt;

&lt;p&gt;if num &amp;gt; 0:&lt;br&gt;
    print("Positive")&lt;br&gt;
elif num &amp;lt; 0:&lt;br&gt;
    print("Negative")&lt;br&gt;
else:&lt;br&gt;
    print("Zero")&lt;/p&gt;

&lt;p&gt;Changing "num" to "10", "-10", or "0" will produce different results.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checking a leap year&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A slightly more interesting example is checking whether a year is a leap year.&lt;/p&gt;

&lt;p&gt;year = 2024&lt;/p&gt;

&lt;p&gt;if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):&lt;br&gt;
    print("Leap year")&lt;br&gt;
else:&lt;br&gt;
    print("Not a leap year")&lt;/p&gt;

&lt;p&gt;This example combines the modulo operator "%" with "and" and "or".&lt;/p&gt;

&lt;p&gt;Try these values:&lt;/p&gt;

&lt;p&gt;2024&lt;br&gt;
2023&lt;br&gt;
2000&lt;br&gt;
1900&lt;/p&gt;

&lt;p&gt;and see what happens.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Comparing two numbers&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can also use conditions to compare values.&lt;/p&gt;

&lt;p&gt;a = 25&lt;br&gt;
b = 40&lt;/p&gt;

&lt;p&gt;if a &amp;gt; b:&lt;br&gt;
    print("a is larger")&lt;br&gt;
elif b &amp;gt; a:&lt;br&gt;
    print("b is larger")&lt;br&gt;
else:&lt;br&gt;
    print("Both are equal")&lt;/p&gt;

&lt;p&gt;The final "else" handles the case where both values are equal.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using if inside a function&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Conditional logic is also commonly used inside functions.&lt;/p&gt;

&lt;p&gt;def check_age(age):&lt;br&gt;
    if age &amp;lt; 18:&lt;br&gt;
        return "Minor"&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return "Adult"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;print(check_age(25))&lt;/p&gt;

&lt;p&gt;Here, the function returns ""Minor"" when the age is below 18. Otherwise, it returns ""Adult"".&lt;/p&gt;

&lt;p&gt;Notice that we don't need an "else" after "return".&lt;/p&gt;

&lt;p&gt;Once "return" runs, the function ends.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Common Python if-else mistakes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using "=" instead of "=="&lt;/p&gt;

&lt;p&gt;Use "=" when assigning a value:&lt;/p&gt;

&lt;p&gt;age = 18&lt;/p&gt;

&lt;p&gt;Use "==" when comparing values:&lt;/p&gt;

&lt;p&gt;if age == 18:&lt;br&gt;
    print("Age is 18")&lt;/p&gt;

&lt;p&gt;Incorrect indentation&lt;/p&gt;

&lt;p&gt;Python uses indentation to define code blocks.&lt;/p&gt;

&lt;p&gt;This is incorrect:&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
print("Adult")&lt;/p&gt;

&lt;p&gt;The correct version is:&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
    print("Adult")&lt;/p&gt;

&lt;p&gt;Using "true" and "false"&lt;/p&gt;

&lt;p&gt;Python uses "True" and "False".&lt;/p&gt;

&lt;p&gt;is_active = True&lt;/p&gt;

&lt;p&gt;if is_active:&lt;br&gt;
    print("Active")&lt;/p&gt;

&lt;p&gt;"true" and "false" are not the Python Boolean values.&lt;/p&gt;

&lt;p&gt;A few things to practice&lt;/p&gt;

&lt;p&gt;After understanding the examples above, try writing these programs yourself:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check whether a number is even or odd.&lt;/li&gt;
&lt;li&gt;Find the largest of three numbers.&lt;/li&gt;
&lt;li&gt;Check whether a person is eligible based on age.&lt;/li&gt;
&lt;li&gt;Convert marks into a grade.&lt;/li&gt;
&lt;li&gt;Check whether a number is positive, negative, or zero.&lt;/li&gt;
&lt;li&gt;Check whether a year is a leap year.&lt;/li&gt;
&lt;li&gt;Check whether a password meets a few basic conditions.&lt;/li&gt;
&lt;li&gt;Use "and", "or", and "not" in a small program.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Try solving them without looking at the examples first.&lt;/p&gt;

&lt;p&gt;More Python if-else examples&lt;/p&gt;

&lt;p&gt;If you want more practice, I have a separate collection of Python conditional-statement examples and questions covering "if", "elif", "else", nested conditions, logical operators, conditional expressions, and practical problems:&lt;/p&gt;

&lt;p&gt;Python If-Else Examples and Interview Questions:&lt;br&gt;
&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-control-structures-if-else.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-control-structures-if-else.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The examples can be useful whether you are learning Python for the first time, working with data, writing automation scripts, or preparing for a Python interview.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python Operators Explained with Simple Examples</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Sun, 27 Sep 2026 18:53:19 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-operators-explained-with-simple-examples-146n</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-operators-explained-with-simple-examples-146n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Python Operators Explained with Simple Examples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python operators are symbols or keywords used to perform operations on values and variables.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;a = 10&lt;br&gt;
b = 3&lt;/p&gt;

&lt;p&gt;print(a + b)&lt;br&gt;
print(a &amp;gt; b)&lt;/p&gt;

&lt;p&gt;Here, "+" adds two values and "&amp;gt;" compares them.&lt;/p&gt;

&lt;p&gt;If you are learning Python or preparing for a Python interview, understanding operators is important because you will use them in almost every Python program.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Main Types of Python Operators&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Operator Type| Common Operators| Used For&lt;br&gt;
Arithmetic| "+ - * / // % **"| Mathematical calculations&lt;br&gt;
Comparison| "== != &amp;gt; &amp;lt; &amp;gt;= &amp;lt;="| Comparing values&lt;br&gt;
Logical| "and or not"| Combining conditions&lt;br&gt;
Assignment| "= += -= *= /="| Assigning and updating values&lt;br&gt;
Membership| "in", "not in"| Checking whether a value exists&lt;br&gt;
Identity| "is", "is not"| Checking object identity&lt;/p&gt;

&lt;p&gt;Let's look at each type with simple examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Arithmetic Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arithmetic operators are used for calculations.&lt;/p&gt;

&lt;p&gt;a = 10&lt;br&gt;
b = 3&lt;/p&gt;

&lt;p&gt;print(a + b)   # 13&lt;br&gt;
print(a - b)   # 7&lt;br&gt;
print(a * b)   # 30&lt;br&gt;
print(a / b)   # 3.3333333333333335&lt;br&gt;
print(a // b)  # 3&lt;br&gt;
print(a % b)   # 1&lt;br&gt;
print(a ** b)  # 1000&lt;/p&gt;

&lt;p&gt;Some operators need special attention.&lt;/p&gt;

&lt;p&gt;"/" Division&lt;/p&gt;

&lt;p&gt;"/" returns the normal division result.&lt;/p&gt;

&lt;p&gt;print(10 / 3)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;3.3333333333333335&lt;/p&gt;

&lt;p&gt;"//" Floor Division&lt;/p&gt;

&lt;p&gt;"//" returns the floor value of the division.&lt;/p&gt;

&lt;p&gt;print(10 // 3)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;3&lt;/p&gt;

&lt;p&gt;"%" Modulus&lt;/p&gt;

&lt;p&gt;"%" returns the remainder.&lt;/p&gt;

&lt;p&gt;print(10 % 3)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;1&lt;/p&gt;

&lt;p&gt;It is often useful for checking whether a number is even or odd.&lt;/p&gt;

&lt;p&gt;number = 10&lt;/p&gt;

&lt;p&gt;if number % 2 == 0:&lt;br&gt;
    print("Even")&lt;/p&gt;

&lt;p&gt;"**" Exponentiation&lt;/p&gt;

&lt;p&gt;"**" is used to raise a number to a power.&lt;/p&gt;

&lt;p&gt;print(2 ** 3)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;8&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Comparison Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Comparison operators compare two values.&lt;/p&gt;

&lt;p&gt;The result is always "True" or "False".&lt;/p&gt;

&lt;p&gt;a = 10&lt;br&gt;
b = 20&lt;/p&gt;

&lt;p&gt;print(a == b)  # False&lt;br&gt;
print(a != b)  # True&lt;br&gt;
print(a &amp;gt; b)   # False&lt;br&gt;
print(a &amp;lt; b)   # True&lt;br&gt;
print(a &amp;gt;= b)  # False&lt;br&gt;
print(a &amp;lt;= b)  # True&lt;/p&gt;

&lt;p&gt;One common mistake is confusing "=" and "==".&lt;/p&gt;

&lt;p&gt;"=" vs "=="&lt;/p&gt;

&lt;p&gt;"=" is used to assign a value.&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;"==" is used to compare two values.&lt;/p&gt;

&lt;p&gt;age == 25&lt;/p&gt;

&lt;p&gt;This difference is very important in Python.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;3. Logical Operators&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Logical operators are mainly used when working with multiple conditions.&lt;/p&gt;

&lt;p&gt;Python has three logical operators:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"and"&lt;/li&gt;
&lt;li&gt;"or"&lt;/li&gt;
&lt;li&gt;"not"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"and"&lt;/p&gt;

&lt;p&gt;Both conditions must be "True".&lt;/p&gt;

&lt;p&gt;age = 25&lt;br&gt;
salary = 50000&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18 and salary &amp;gt;= 30000:&lt;br&gt;
    print("Eligible")&lt;/p&gt;

&lt;p&gt;"or"&lt;/p&gt;

&lt;p&gt;At least one condition must be "True".&lt;/p&gt;

&lt;p&gt;age = 25&lt;br&gt;
salary = 20000&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18 or salary &amp;gt;= 30000:&lt;br&gt;
    print("Eligible")&lt;/p&gt;

&lt;p&gt;"not"&lt;/p&gt;

&lt;p&gt;"not" reverses the result.&lt;/p&gt;

&lt;p&gt;is_active = True&lt;/p&gt;

&lt;p&gt;print(not is_active)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;False&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;4. Assignment Operators&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Assignment operators are used to assign or update values.&lt;/p&gt;

&lt;p&gt;salary = 50000&lt;/p&gt;

&lt;p&gt;salary += 5000&lt;br&gt;
print(salary)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;55000&lt;/p&gt;

&lt;p&gt;Here are some common assignment operators:&lt;/p&gt;

&lt;p&gt;Operator| Example| Meaning&lt;br&gt;
"="| "x = 10"| Assign 10 to x&lt;br&gt;
"+="| "x += 5"| Add 5 to x&lt;br&gt;
"-="| "x -= 5"| Subtract 5 from x&lt;br&gt;
"*="| "x *= 5"| Multiply x by 5&lt;br&gt;
"/="| "x /= 5"| Divide x by 5&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;x = 10&lt;/p&gt;

&lt;p&gt;x += 5&lt;br&gt;
print(x)  # 15&lt;/p&gt;

&lt;p&gt;x -= 3&lt;br&gt;
print(x)  # 12&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;5. Membership Operators&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Membership operators check whether a value exists inside a sequence such as a list or string.&lt;/p&gt;

&lt;p&gt;The two membership operators are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"in"&lt;/li&gt;
&lt;li&gt;"not in"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;languages = ["Python", "Java", "SQL"]&lt;/p&gt;

&lt;p&gt;print("Python" in languages)&lt;br&gt;
print("C++" in languages)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;br&gt;
False&lt;/p&gt;

&lt;p&gt;You can also use them with strings:&lt;/p&gt;

&lt;p&gt;name = "Python Programming"&lt;/p&gt;

&lt;p&gt;print("Python" in name)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;6. Identity Operators&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Python has two identity operators:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"is"&lt;/li&gt;
&lt;li&gt;"is not"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They check whether two variables refer to the same object.&lt;/p&gt;

&lt;p&gt;a = [1, 2, 3]&lt;br&gt;
b = a&lt;/p&gt;

&lt;p&gt;print(a is b)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;Here, "b" refers to the same list object as "a".&lt;/p&gt;

&lt;p&gt;"==" vs "is"&lt;/p&gt;

&lt;p&gt;This is an important Python interview question.&lt;/p&gt;

&lt;p&gt;"==" checks whether two values are equal.&lt;/p&gt;

&lt;p&gt;"is" checks whether two variables refer to the same object.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;a = [1, 2, 3]&lt;br&gt;
b = [1, 2, 3]&lt;/p&gt;

&lt;p&gt;print(a == b)&lt;br&gt;
print(a is b)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;br&gt;
False&lt;/p&gt;

&lt;p&gt;The values are equal, but they are different list objects.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;7. Operator Precedence&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
When an expression contains multiple operators, Python follows operator precedence to decide which operation happens first.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;result = 10 + 5 * 2&lt;/p&gt;

&lt;p&gt;print(result)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;20&lt;/p&gt;

&lt;p&gt;Multiplication happens before addition.&lt;/p&gt;

&lt;p&gt;You can use parentheses when you want to make the order clear:&lt;/p&gt;

&lt;p&gt;result = (10 + 5) * 2&lt;/p&gt;

&lt;p&gt;print(result)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;p&gt;Using parentheses also makes the code easier to read.&lt;/p&gt;

&lt;p&gt;A Small Practical Example&lt;/p&gt;

&lt;p&gt;Suppose we have an employee salary and want to calculate a bonus.&lt;/p&gt;

&lt;p&gt;salary = 50000&lt;br&gt;
bonus = 5000&lt;/p&gt;

&lt;p&gt;total_salary = salary + bonus&lt;/p&gt;

&lt;p&gt;if total_salary &amp;gt;= 55000:&lt;br&gt;
    print("Salary target reached")&lt;/p&gt;

&lt;p&gt;This small example uses different operators together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"+" calculates the total salary.&lt;/li&gt;
&lt;li&gt;"&amp;gt;=" compares the salary.&lt;/li&gt;
&lt;li&gt;"=" assigns values.&lt;/li&gt;
&lt;li&gt;"if" uses the result of the comparison.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how operators are normally used in real Python programs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Revision&lt;br&gt;
**&lt;br&gt;
Operator| Example| Purpose&lt;br&gt;
"+"| "a + b"| Addition&lt;br&gt;
"-"| "a - b"| Subtraction&lt;br&gt;
"*"| "a * b"| Multiplication&lt;br&gt;
"/"| "a / b"| Division&lt;br&gt;
"//"| "a // b"| Floor division&lt;br&gt;
"%"| "a % b"| Remainder&lt;br&gt;
"&lt;/strong&gt;"| "a ** b"| Power&lt;br&gt;
"=="| "a == b"| Equal comparison&lt;br&gt;
"!="| "a != b"| Not equal&lt;br&gt;
"&amp;gt;"| "a &amp;gt; b"| Greater than&lt;br&gt;
"&amp;lt;"| "a &amp;lt; b"| Less than&lt;br&gt;
"and"| "a and b"| Both conditions&lt;br&gt;
"or"| "a or b"| Either condition&lt;br&gt;
"not"| "not a"| Reverse condition&lt;br&gt;
"in"| "x in list"| Check membership&lt;br&gt;
"is"| "a is b"| Check object identity&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frequently Asked Questions&lt;br&gt;
**&lt;br&gt;
**What is the difference between "/" and "//" in Python&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;"/" performs normal division and returns a division result.&lt;/p&gt;

&lt;p&gt;"//" performs floor division and returns the floor value.&lt;/p&gt;

&lt;p&gt;print(10 / 3)   # 3.3333333333333335&lt;br&gt;
print(10 // 3)  # 3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between "==" and "is" in Python?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"==" checks whether two values are equal.&lt;/p&gt;

&lt;p&gt;"is" checks whether two variables refer to the same object.&lt;/p&gt;

&lt;p&gt;This is an important difference to understand when working with Python objects.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;More Python Operators Interview Questions&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
If you are preparing for a Python interview, you can find more operator-based interview questions and answers here:&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;"Python Operators Interview Questions and Answers" (&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-operators-overview.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-operators-overview.html&lt;/a&gt;)&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The examples cover the important Python operators and explain where they are used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python operators are simple, but they are used everywhere in Python programming.&lt;/p&gt;

&lt;p&gt;The most important ones to understand first are arithmetic, comparison, logical, assignment, membership, and identity operators.&lt;/p&gt;

&lt;p&gt;Once these operators are clear, writing conditions and calculations in Python becomes much easier..&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python Data Types Explained With Practical Examples</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Fri, 25 Sep 2026 04:00:40 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-data-types-explained-with-practical-examples-51m4</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-data-types-explained-with-practical-examples-51m4</guid>
      <description>&lt;p&gt;Python Data Types Explained With Practical Examples&lt;/p&gt;

&lt;p&gt;When you write a Python program, you work with different kinds of values every day.&lt;/p&gt;

&lt;p&gt;You might store a person's name, an age, a price, a list of products, or information returned by an API. Python needs to know what kind of value it is dealing with, and that's where data types come in.&lt;/p&gt;

&lt;p&gt;If you're learning Python, data types are one of those topics that look simple at first but become important when you start working with functions, APIs, databases, Pandas, or data analysis.&lt;/p&gt;

&lt;p&gt;Let's look at the most commonly used Python data types with simple examples.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Numbers: "int" and "float"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Python uses "int" for whole numbers and "float" for numbers with decimal values.&lt;/p&gt;

&lt;p&gt;age = 45&lt;br&gt;
price = 1250.50&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;br&gt;
print(type(price))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;



&lt;p&gt;For example, an age would normally be an integer, while a product price might contain decimal values.&lt;/p&gt;

&lt;p&gt;One thing worth knowing about floats is that they don't always represent decimal numbers exactly.&lt;/p&gt;

&lt;p&gt;print(0.1 + 0.2)&lt;/p&gt;

&lt;p&gt;You may get:&lt;/p&gt;

&lt;p&gt;0.30000000000000004&lt;/p&gt;

&lt;p&gt;This isn't a Python bug. It comes from the way floating-point numbers are represented internally.&lt;/p&gt;

&lt;p&gt;It becomes especially important when you're working with calculations where precision matters.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Strings&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A string is a sequence of characters.&lt;/p&gt;

&lt;p&gt;name = "Kailas"&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(type(name))&lt;/p&gt;

&lt;p&gt;Strings support indexing:&lt;/p&gt;

&lt;p&gt;language = "Python"&lt;/p&gt;

&lt;p&gt;print(language[0])&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;P&lt;/p&gt;

&lt;p&gt;You can also take a part of a string using slicing:&lt;/p&gt;

&lt;p&gt;print(language[0:3])&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Pyt&lt;/p&gt;

&lt;p&gt;One important point is that strings are immutable.&lt;/p&gt;

&lt;p&gt;You can't change one character directly after the string has been created.&lt;/p&gt;

&lt;p&gt;name = "Python"&lt;/p&gt;
&lt;h1&gt;
  
  
  name[0] = "J"   # TypeError
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A list is useful when you need to keep multiple values together.&lt;/p&gt;

&lt;p&gt;languages = ["Python", "SQL", "Java"]&lt;/p&gt;

&lt;p&gt;print(languages)&lt;/p&gt;

&lt;p&gt;One of the biggest advantages of a list is that it can be changed.&lt;/p&gt;

&lt;p&gt;languages[1] = "C++"&lt;/p&gt;

&lt;p&gt;print(languages)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;['Python', 'C++', 'Java']&lt;/p&gt;

&lt;p&gt;You can also add new values:&lt;/p&gt;

&lt;p&gt;languages.append("Go")&lt;/p&gt;

&lt;p&gt;This is why lists are commonly used when the collection of values may change during program execution.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tuples&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Tuples also store multiple values, but they are immutable.&lt;/p&gt;

&lt;p&gt;coordinates = (18.52, 73.85)&lt;/p&gt;

&lt;p&gt;print(coordinates)&lt;/p&gt;

&lt;p&gt;Once a tuple is created, you can't change one of its elements.&lt;/p&gt;

&lt;p&gt;A simple way to remember the difference is:&lt;/p&gt;

&lt;p&gt;List   → mutable&lt;br&gt;
Tuple  → immutable&lt;/p&gt;

&lt;p&gt;Neither is automatically better. The right choice depends on what you need to do with the data.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dictionaries&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A dictionary stores information using key-value pairs.&lt;/p&gt;

&lt;p&gt;student = {&lt;br&gt;
    "name": "Rahul",&lt;br&gt;
    "age": 25,&lt;br&gt;
    "city": "Pune"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;print(student["name"])&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Rahul&lt;/p&gt;

&lt;p&gt;This is useful when the meaning of each value matters.&lt;/p&gt;

&lt;p&gt;Compare:&lt;/p&gt;

&lt;p&gt;student = ["Rahul", 25, "Pune"]&lt;/p&gt;

&lt;p&gt;with:&lt;/p&gt;

&lt;p&gt;student = {&lt;br&gt;
    "name": "Rahul",&lt;br&gt;
    "age": 25,&lt;br&gt;
    "city": "Pune"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;The second version makes the data much easier to understand.&lt;/p&gt;

&lt;p&gt;Dictionaries are widely used in Python applications, APIs, configuration files, and JSON data.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A set is a collection that stores unique values.&lt;/p&gt;

&lt;p&gt;numbers = {10, 20, 30, 10, 20}&lt;/p&gt;

&lt;p&gt;print(numbers)&lt;/p&gt;

&lt;p&gt;The duplicate values are removed.&lt;/p&gt;

&lt;p&gt;Sets are particularly useful when you need operations such as union, intersection, or difference.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;a = {1, 2, 3}&lt;br&gt;
b = {3, 4, 5}&lt;/p&gt;

&lt;p&gt;print(a.intersection(b))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;{3}&lt;/p&gt;

&lt;p&gt;If your main requirement is to work with unique values, a set can be very convenient.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Boolean Values&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Boolean values represent either "True" or "False".&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;is_adult = age &amp;gt;= 18&lt;/p&gt;

&lt;p&gt;print(is_adult)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;You'll see Boolean values everywhere in Python, especially in conditions, filtering, validation, and data processing.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;if is_adult:&lt;br&gt;
    print("Allowed")&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is "None" in Python?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"None" is a special value that represents the absence of a value.&lt;/p&gt;

&lt;p&gt;result = None&lt;/p&gt;

&lt;p&gt;print(result)&lt;br&gt;
print(type(result))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;None&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;It's important not to confuse "None" with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"0"&lt;/li&gt;
&lt;li&gt;"False"&lt;/li&gt;
&lt;li&gt;""""&lt;/li&gt;
&lt;li&gt;an empty list&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They represent different things.&lt;/p&gt;

&lt;p&gt;You'll often encounter "None" when working with functions, databases, APIs, and optional values.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type Conversion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sometimes the value you receive isn't in the type you need.&lt;/p&gt;

&lt;p&gt;A common example is user input.&lt;/p&gt;

&lt;p&gt;age = input("Enter your age: ")&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;/p&gt;

&lt;p&gt;Even if the user enters:&lt;/p&gt;

&lt;p&gt;45&lt;/p&gt;

&lt;p&gt;the result from "input()" is a string.&lt;/p&gt;

&lt;p&gt;If you want to perform numerical calculations, you can convert it:&lt;/p&gt;

&lt;p&gt;age = int(age)&lt;/p&gt;

&lt;p&gt;print(age + 5)&lt;/p&gt;

&lt;p&gt;Python provides several common conversion functions:&lt;/p&gt;

&lt;p&gt;int()&lt;br&gt;
float()&lt;br&gt;
str()&lt;br&gt;
list()&lt;br&gt;
tuple()&lt;/p&gt;

&lt;p&gt;But conversion isn't always possible.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;int("Python")&lt;/p&gt;

&lt;p&gt;will raise a "ValueError" because ""Python"" cannot be converted into an integer.&lt;/p&gt;

&lt;p&gt;This is something you'll frequently deal with when processing files, APIs, databases, and user input.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Mutable vs Immutable Data Types&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is one of the Python concepts that is worth understanding properly.&lt;/p&gt;

&lt;p&gt;Some objects can be changed after they are created. Others cannot.&lt;/p&gt;

&lt;p&gt;Common mutable types include:&lt;/p&gt;

&lt;p&gt;list&lt;br&gt;
dict&lt;br&gt;
set&lt;/p&gt;

&lt;p&gt;Common immutable types include:&lt;/p&gt;

&lt;p&gt;int&lt;br&gt;
float&lt;br&gt;
str&lt;br&gt;
tuple&lt;br&gt;
bool&lt;/p&gt;

&lt;p&gt;For example, a list can be modified:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30]&lt;/p&gt;

&lt;p&gt;numbers.append(40)&lt;/p&gt;

&lt;p&gt;print(numbers)&lt;/p&gt;

&lt;p&gt;The same list now contains the additional value.&lt;/p&gt;

&lt;p&gt;Strings behave differently:&lt;/p&gt;

&lt;p&gt;name = "Python"&lt;/p&gt;

&lt;h1&gt;
  
  
  name[0] = "J"
&lt;/h1&gt;

&lt;p&gt;The code above raises an error because strings are immutable.&lt;/p&gt;

&lt;p&gt;This distinction becomes particularly important when you start learning about object references, copying, functions, and shallow vs deep copy.&lt;/p&gt;

&lt;p&gt;A Practical Example&lt;/p&gt;

&lt;p&gt;Imagine you're working on a small employee application.&lt;/p&gt;

&lt;p&gt;You might have:&lt;/p&gt;

&lt;p&gt;employee_id = 101&lt;br&gt;
employee_name = "Amit"&lt;br&gt;
salary = 55000.50&lt;br&gt;
is_active = True&lt;/p&gt;

&lt;p&gt;skills = ["Python", "SQL", "Power BI"]&lt;/p&gt;

&lt;p&gt;employee = {&lt;br&gt;
    "id": employee_id,&lt;br&gt;
    "name": employee_name,&lt;br&gt;
    "salary": salary,&lt;br&gt;
    "active": is_active,&lt;br&gt;
    "skills": skills&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Here, several Python data types are working together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"101" → "int"&lt;/li&gt;
&lt;li&gt;""Amit"" → "str"&lt;/li&gt;
&lt;li&gt;"55000.50" → "float"&lt;/li&gt;
&lt;li&gt;"True" → "bool"&lt;/li&gt;
&lt;li&gt;"skills" → "list"&lt;/li&gt;
&lt;li&gt;"employee" → "dict"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is much closer to how you'll actually encounter data types in a real Python application.&lt;/p&gt;

&lt;p&gt;Why Data Types Matter Beyond Python Basics&lt;/p&gt;

&lt;p&gt;Data types become even more important when you move into data analytics and data engineering.&lt;/p&gt;

&lt;p&gt;For example, an API might return:&lt;/p&gt;

&lt;p&gt;age = "45"&lt;/p&gt;

&lt;p&gt;while your calculation expects:&lt;/p&gt;

&lt;p&gt;age = 45&lt;/p&gt;

&lt;p&gt;Or a column in a dataset might contain a mixture of numbers and strings.&lt;/p&gt;

&lt;p&gt;Before performing calculations or transformations, you need to understand what you're actually working with.&lt;/p&gt;

&lt;p&gt;That's why Python data types are not just an interview topic. They are part of everyday Python programming.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;The most important Python data types to understand first are:&lt;/p&gt;

&lt;p&gt;int&lt;br&gt;
float&lt;br&gt;
str&lt;br&gt;
bool&lt;br&gt;
list&lt;br&gt;
tuple&lt;br&gt;
set&lt;br&gt;
dict&lt;br&gt;
None&lt;/p&gt;

&lt;p&gt;Don't try to memorize them only for an interview.&lt;/p&gt;

&lt;p&gt;Try small examples and pay attention to what can be changed, how values are accessed, and what happens when you convert one type to another.&lt;/p&gt;

&lt;p&gt;Once these basics are clear, topics like functions, APIs, Pandas, data cleaning, and data analysis become much easier to understand.&lt;/p&gt;

&lt;p&gt;Preparing for a Python Interview?&lt;/p&gt;

&lt;p&gt;If you want to go beyond these basic examples, I've put together a detailed Python Data Types Interview Questions and Answers guide on SankalanTech.&lt;/p&gt;

&lt;p&gt;It covers questions around:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in data types&lt;/li&gt;
&lt;li&gt;Lists vs tuples&lt;/li&gt;
&lt;li&gt;Dictionaries&lt;/li&gt;
&lt;li&gt;Sets&lt;/li&gt;
&lt;li&gt;"int" vs "float"&lt;/li&gt;
&lt;li&gt;Strings&lt;/li&gt;
&lt;li&gt;"None"&lt;/li&gt;
&lt;li&gt;Type conversion&lt;/li&gt;
&lt;li&gt;Shallow vs deep copy&lt;/li&gt;
&lt;li&gt;Dynamic typing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the complete Python Data Types interview guide on SankalanTech:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-data-types-guide.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-data-types-guide.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use this article to understand the concepts with examples, and the detailed guide for deeper interview preparation.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python Variables: Why y = x Sometimes Changes Both Variables</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Fri, 18 Sep 2026 06:17:31 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-variables-why-y-x-sometimes-changes-both-variables-58kk</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-variables-why-y-x-sometimes-changes-both-variables-58kk</guid>
      <description>&lt;p&gt;Python: Why Changing "y" Can Sometimes Change "x" Too&lt;/p&gt;

&lt;p&gt;You write:&lt;/p&gt;

&lt;p&gt;x = 10&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;Then you change "y".&lt;/p&gt;

&lt;p&gt;Sometimes "x" stays the same.&lt;/p&gt;

&lt;p&gt;Sometimes "x" changes too.&lt;/p&gt;

&lt;p&gt;That sounds strange until you understand what "=" actually does in Python.&lt;/p&gt;

&lt;p&gt;First, look at this example&lt;/p&gt;

&lt;p&gt;x = 10&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;x = 20&lt;/p&gt;

&lt;p&gt;print(x)&lt;br&gt;
print(y)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;20&lt;br&gt;
10&lt;/p&gt;

&lt;p&gt;Changing "x" did not change "y".&lt;/p&gt;

&lt;p&gt;Now look at this:&lt;/p&gt;

&lt;p&gt;x = [10, 20, 30]&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;y.append(40)&lt;/p&gt;

&lt;p&gt;print(x)&lt;br&gt;
print(y)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;[10, 20, 30, 40]&lt;br&gt;
[10, 20, 30, 40]&lt;/p&gt;

&lt;p&gt;This time, changing "y" also changed what we see through "x".&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;The answer is mutation and reassignment.&lt;/p&gt;

&lt;p&gt;"y = x" does not create a copy&lt;/p&gt;

&lt;p&gt;When you write:&lt;/p&gt;

&lt;p&gt;x = [10, 20, 30]&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;Python does not create another list containing the same values.&lt;/p&gt;

&lt;p&gt;Both names refer to the same list object.&lt;/p&gt;

&lt;p&gt;So when you do:&lt;/p&gt;

&lt;p&gt;y.append(40)&lt;/p&gt;

&lt;p&gt;you are changing that list.&lt;/p&gt;

&lt;p&gt;Since "x" also refers to that same list, "x" now shows:&lt;/p&gt;

&lt;p&gt;[10, 20, 30, 40]&lt;/p&gt;

&lt;p&gt;A simple way to remember it:&lt;/p&gt;

&lt;p&gt;Reassignment → changes what a name refers to.&lt;/p&gt;

&lt;p&gt;Mutation → changes the object itself.&lt;/p&gt;

&lt;p&gt;Reassignment vs mutation&lt;/p&gt;

&lt;p&gt;Consider this:&lt;/p&gt;

&lt;p&gt;x = 10&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;x = 20&lt;/p&gt;

&lt;p&gt;Here, "x" is reassigned.&lt;/p&gt;

&lt;p&gt;It now refers to "20".&lt;/p&gt;

&lt;p&gt;"y" still refers to "10".&lt;/p&gt;

&lt;p&gt;But with a list:&lt;/p&gt;

&lt;p&gt;x = [10, 20]&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;y.append(30)&lt;/p&gt;

&lt;p&gt;"y.append(30)" changes the existing list.&lt;/p&gt;

&lt;p&gt;So both "x" and "y" show:&lt;/p&gt;

&lt;p&gt;[10, 20, 30]&lt;/p&gt;

&lt;p&gt;This difference is one of those small Python concepts that becomes very important when working with real programs.&lt;/p&gt;

&lt;p&gt;Mutable and immutable objects&lt;/p&gt;

&lt;p&gt;This is where another Python concept becomes useful.&lt;/p&gt;

&lt;p&gt;Some objects can be changed after they are created.&lt;/p&gt;

&lt;p&gt;These are called mutable objects.&lt;/p&gt;

&lt;p&gt;Common examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"list"&lt;/li&gt;
&lt;li&gt;"dict"&lt;/li&gt;
&lt;li&gt;"set"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some objects cannot be changed in place.&lt;/p&gt;

&lt;p&gt;These are called immutable objects.&lt;/p&gt;

&lt;p&gt;Common examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"int"&lt;/li&gt;
&lt;li&gt;"float"&lt;/li&gt;
&lt;li&gt;"str"&lt;/li&gt;
&lt;li&gt;"tuple"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30]&lt;br&gt;
numbers.append(40)&lt;/p&gt;

&lt;p&gt;The existing list is modified.&lt;/p&gt;

&lt;p&gt;But:&lt;/p&gt;

&lt;p&gt;x = 10&lt;br&gt;
x = 20&lt;/p&gt;

&lt;p&gt;does not modify the integer "10".&lt;/p&gt;

&lt;p&gt;The name "x" is simply reassigned.&lt;/p&gt;

&lt;p&gt;Here is another example that can confuse you&lt;/p&gt;

&lt;p&gt;Predict the output before running this:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30]&lt;/p&gt;

&lt;p&gt;other_numbers = numbers&lt;/p&gt;

&lt;p&gt;numbers = [100, 200, 300]&lt;/p&gt;

&lt;p&gt;other_numbers.append(40)&lt;/p&gt;

&lt;p&gt;print(numbers)&lt;br&gt;
print(other_numbers)&lt;/p&gt;

&lt;p&gt;The output is:&lt;/p&gt;

&lt;p&gt;[100, 200, 300]&lt;br&gt;
[10, 20, 30, 40]&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Initially:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30]&lt;br&gt;
other_numbers = numbers&lt;/p&gt;

&lt;p&gt;Both names refer to the first list.&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;p&gt;numbers = [100, 200, 300]&lt;/p&gt;

&lt;p&gt;This does not change the old list.&lt;/p&gt;

&lt;p&gt;It makes "numbers" refer to a new list.&lt;/p&gt;

&lt;p&gt;"other_numbers" is still referring to the original list.&lt;/p&gt;

&lt;p&gt;So:&lt;/p&gt;

&lt;p&gt;other_numbers.append(40)&lt;/p&gt;

&lt;p&gt;changes only the original list.&lt;/p&gt;

&lt;p&gt;One more Python variable trap: "input()"&lt;/p&gt;

&lt;p&gt;There is another small thing that often causes confusion.&lt;/p&gt;

&lt;p&gt;Look at this:&lt;/p&gt;

&lt;p&gt;age = input("Enter your age: ")&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;/p&gt;

&lt;p&gt;If you enter:&lt;/p&gt;

&lt;p&gt;25&lt;/p&gt;

&lt;p&gt;the result is:&lt;/p&gt;



&lt;p&gt;Even though you entered a number.&lt;/p&gt;

&lt;p&gt;"input()" returns a string.&lt;/p&gt;

&lt;p&gt;If you actually need an integer:&lt;/p&gt;

&lt;p&gt;age = int(input("Enter your age: "))&lt;/p&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;/p&gt;

&lt;p&gt;gives:&lt;/p&gt;



&lt;p&gt;This matters when you start doing calculations.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = input("Enter your age: ")&lt;/p&gt;

&lt;p&gt;print(age + 5)&lt;/p&gt;

&lt;p&gt;This will not work as expected because "age" is a string.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;p&gt;age = int(input("Enter your age: "))&lt;/p&gt;

&lt;p&gt;print(age + 5)&lt;/p&gt;

&lt;p&gt;Don't confuse "=" with "=="&lt;/p&gt;

&lt;p&gt;Another basic mistake is confusing these two operators.&lt;/p&gt;

&lt;p&gt;"=" means assignment:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;"==" means comparison:&lt;/p&gt;

&lt;p&gt;age == 25&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;if age == 25:&lt;br&gt;
    print("Age is 25")&lt;/p&gt;

&lt;p&gt;A simple rule:&lt;/p&gt;

&lt;p&gt;"=" → assign&lt;/p&gt;

&lt;p&gt;"==" → compare&lt;/p&gt;

&lt;p&gt;Python is dynamically typed&lt;/p&gt;

&lt;p&gt;Python variables do not need a type declaration like some other programming languages.&lt;/p&gt;

&lt;p&gt;You can write:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;and later:&lt;/p&gt;

&lt;p&gt;age = "25"&lt;/p&gt;

&lt;p&gt;The same name can refer to objects of different types at different times.&lt;/p&gt;

&lt;p&gt;You can check the current type with:&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;/p&gt;

&lt;p&gt;This is called dynamic typing.&lt;/p&gt;

&lt;p&gt;Choose variable names that explain the value&lt;/p&gt;

&lt;p&gt;Technically, this works:&lt;/p&gt;

&lt;p&gt;a = 45000&lt;br&gt;
b = 12&lt;br&gt;
c = a / b&lt;/p&gt;

&lt;p&gt;But this is easier to understand:&lt;/p&gt;

&lt;p&gt;annual_salary = 45000&lt;br&gt;
months = 12&lt;br&gt;
monthly_salary = annual_salary / months&lt;/p&gt;

&lt;p&gt;Good variable names make code easier to read, debug, and maintain.&lt;/p&gt;

&lt;p&gt;Especially when you come back to your code after a few weeks.&lt;/p&gt;

&lt;p&gt;Try these before you run them&lt;/p&gt;

&lt;p&gt;Don't run these immediately.&lt;/p&gt;

&lt;p&gt;Predict the output first.&lt;/p&gt;

&lt;p&gt;Question 1&lt;/p&gt;

&lt;p&gt;x = [1, 2, 3]&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;y.append(4)&lt;/p&gt;

&lt;p&gt;print(x)&lt;/p&gt;

&lt;p&gt;What will it print?&lt;/p&gt;

&lt;p&gt;Question 2&lt;/p&gt;

&lt;p&gt;x = 10&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;y = 20&lt;/p&gt;

&lt;p&gt;print(x)&lt;br&gt;
print(y)&lt;/p&gt;

&lt;p&gt;What will it print?&lt;/p&gt;

&lt;p&gt;Question 3&lt;/p&gt;

&lt;p&gt;x = [1, 2, 3]&lt;br&gt;
y = x&lt;/p&gt;

&lt;p&gt;x = [10, 20, 30]&lt;/p&gt;

&lt;p&gt;y.append(4)&lt;/p&gt;

&lt;p&gt;print(x)&lt;br&gt;
print(y)&lt;/p&gt;

&lt;p&gt;Can you predict both outputs?&lt;/p&gt;

&lt;p&gt;If you can explain why the answers are different, you understand the important part.&lt;/p&gt;

&lt;p&gt;Want the Python Variable Basics in One Place?&lt;/p&gt;

&lt;p&gt;If you're preparing for Python interviews or want a reference for Python syntax, variable naming rules, data types, dynamic typing, multiple assignment, scope, "input()", and related questions, I've collected those topics here:&lt;/p&gt;

&lt;p&gt;Python Syntax and Variables Interview Q&amp;amp;A&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-syntax-variables-tutorial.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-syntax-variables-tutorial.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use it as a reference when you want to revise the broader Python syntax and variable concepts.&lt;/p&gt;

&lt;p&gt;Final challenge&lt;/p&gt;

&lt;p&gt;What will this program print?&lt;/p&gt;

&lt;p&gt;items = ["SQL", "Python"]&lt;/p&gt;

&lt;p&gt;copy_of_items = items&lt;/p&gt;

&lt;p&gt;items = ["Python", "GCP"]&lt;/p&gt;

&lt;p&gt;copy_of_items.append("BigQuery")&lt;/p&gt;

&lt;p&gt;print(items)&lt;br&gt;
print(copy_of_items)&lt;/p&gt;

&lt;p&gt;Will ""BigQuery"" appear in both lists?&lt;/p&gt;

&lt;p&gt;Don't run it immediately.&lt;/p&gt;

&lt;p&gt;Think about these three things first:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What object does "items" refer to initially?&lt;/li&gt;
&lt;li&gt;What happens when "items" is reassigned?&lt;/li&gt;
&lt;li&gt;Which object does "copy_of_items" still refer to?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's the part of Python variables that is easy to miss when you're just learning the syntax.&lt;/p&gt;

</description>
      <category>pythonvariable</category>
      <category>python</category>
    </item>
    <item>
      <title>10 Python Variable Mistakes Developers Still Make (And How to Fix Them)</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Wed, 16 Sep 2026 06:40:06 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/10-python-variable-mistakes-developers-still-make-and-how-to-fix-them-4m66</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/10-python-variable-mistakes-developers-still-make-and-how-to-fix-them-4m66</guid>
      <description>&lt;p&gt;When you first start writing Python, variables seem pretty simple.&lt;/p&gt;

&lt;p&gt;You write something like:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;br&gt;
age = 25&lt;/p&gt;

&lt;p&gt;and move on.&lt;/p&gt;

&lt;p&gt;But as your programs become larger, small mistakes around variable names, data types, input, assignment, and scope can lead to confusing errors.&lt;/p&gt;

&lt;p&gt;Most of these mistakes are easy to fix once you understand what is happening.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are 10 common Python variable mistakes that are worth knowing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Starting a variable name with a number&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Python variable name cannot start with a number.&lt;/p&gt;

&lt;p&gt;This is invalid:&lt;/p&gt;

&lt;p&gt;2name = "Python"&lt;/p&gt;

&lt;p&gt;Python will raise a "SyntaxError".&lt;/p&gt;

&lt;p&gt;Numbers can be used inside a variable name or at the end:&lt;/p&gt;

&lt;p&gt;name2 = "Python"&lt;br&gt;
student2 = "Rahul"&lt;/p&gt;

&lt;p&gt;You can also start a variable name with an underscore:&lt;/p&gt;

&lt;p&gt;_name = "Python"&lt;/p&gt;

&lt;p&gt;A simple rule:&lt;/p&gt;

&lt;p&gt;Start a variable name with a letter or an underscore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Putting spaces in variable names&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Spaces are not allowed inside Python variable names.&lt;/p&gt;

&lt;p&gt;This will not work:&lt;/p&gt;

&lt;p&gt;student name = "Rahul"&lt;/p&gt;

&lt;p&gt;If you want to combine multiple words, use an underscore:&lt;/p&gt;

&lt;p&gt;student_name = "Rahul"&lt;br&gt;
first_name = "Rahul"&lt;br&gt;
last_name = "Patil"&lt;/p&gt;

&lt;p&gt;This naming style is commonly called snake_case.&lt;/p&gt;

&lt;p&gt;Compare:&lt;/p&gt;

&lt;p&gt;studentname = "Rahul"&lt;/p&gt;

&lt;p&gt;with:&lt;/p&gt;

&lt;p&gt;student_name = "Rahul"&lt;/p&gt;

&lt;p&gt;The second version is easier to read, especially when variable names become longer.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;3. Using Python keywords as variable names&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Python has reserved keywords that are used by the language itself.&lt;/p&gt;

&lt;p&gt;Some examples are:&lt;/p&gt;

&lt;p&gt;if&lt;br&gt;
else&lt;br&gt;
for&lt;br&gt;
while&lt;br&gt;
class&lt;br&gt;
def&lt;br&gt;
return&lt;br&gt;
import&lt;br&gt;
try&lt;br&gt;
except&lt;/p&gt;

&lt;p&gt;You should not use these keywords as variable names.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;class = "Python"&lt;/p&gt;

&lt;p&gt;This produces a syntax error.&lt;/p&gt;

&lt;p&gt;Instead, choose a different name:&lt;/p&gt;

&lt;p&gt;class_name = "Python"&lt;/p&gt;

&lt;p&gt;If you want to check the keywords available in your Python version, you can use:&lt;/p&gt;

&lt;p&gt;import keyword&lt;/p&gt;

&lt;p&gt;print(keyword.kwlist)&lt;/p&gt;

&lt;p&gt;This is a useful little trick when you are unsure whether a word can be used as an identifier.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;4. Forgetting that Python is case-sensitive&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Python treats uppercase and lowercase names as different.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;/p&gt;

&lt;p&gt;print(Name)&lt;/p&gt;

&lt;p&gt;This produces a "NameError" because "name" and "Name" are different identifiers.&lt;/p&gt;

&lt;p&gt;You can actually create both:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;br&gt;
Name = "Python"&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(Name)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Rahul&lt;br&gt;
Python&lt;/p&gt;

&lt;p&gt;There is nothing technically wrong with this, but using names that differ only by capitalization can make code difficult to understand.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;customer = "Rahul"&lt;br&gt;
Customer = "Amit"&lt;/p&gt;

&lt;p&gt;Someone reading this code can easily confuse the two.&lt;/p&gt;

&lt;p&gt;Be consistent with capitalization.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;5. Mixing up "=" and "=="&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
This is one of the easiest mistakes to make when learning Python.&lt;/p&gt;

&lt;p&gt;The "=" operator is used for assignment.&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;Here, the value "25" is assigned to "age".&lt;/p&gt;

&lt;p&gt;The "==" operator is used for comparison.&lt;/p&gt;

&lt;p&gt;age == 25&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;if age == 25:&lt;br&gt;
    print("Age is 25")&lt;/p&gt;

&lt;p&gt;A simple way to remember:&lt;/p&gt;

&lt;p&gt;=   -&amp;gt; assign a value&lt;br&gt;
==  -&amp;gt; compare values&lt;/p&gt;

&lt;p&gt;The difference is small when you look at it, but it is very important when writing conditions.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;6. Forgetting that "input()" returns a string&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
This is a very common problem in beginner Python programs.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;age = input("Enter your age: ")&lt;/p&gt;

&lt;p&gt;print(age + 1)&lt;/p&gt;

&lt;p&gt;Suppose the user enters:&lt;/p&gt;

&lt;p&gt;25&lt;/p&gt;

&lt;p&gt;It may look like Python received the number "25".&lt;/p&gt;

&lt;p&gt;Actually, "input()" returns the value as a string:&lt;/p&gt;

&lt;p&gt;"25"&lt;/p&gt;

&lt;p&gt;So Python cannot add the integer "1" directly to it.&lt;/p&gt;

&lt;p&gt;You will get a "TypeError".&lt;/p&gt;

&lt;p&gt;If you need an integer, convert the input:&lt;/p&gt;

&lt;p&gt;age = int(input("Enter your age: "))&lt;/p&gt;

&lt;p&gt;print(age + 1)&lt;/p&gt;

&lt;p&gt;For a decimal value:&lt;/p&gt;

&lt;p&gt;price = float(input("Enter price: "))&lt;/p&gt;

&lt;p&gt;This is an important concept to understand because user input is very common in Python programs.&lt;/p&gt;

&lt;p&gt;If you want to learn Python syntax and variables in more detail, including related concepts and interview questions, you can use the&lt;br&gt;
 *&lt;em&gt;"Python Syntax and Variables guide" *&lt;/em&gt;(&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-syntax-variables-tutorial.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/python-syntax-variables-tutorial.html&lt;/a&gt;) as a reference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Combining strings and numbers incorrectly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another common mistake is trying to concatenate a string and a number using "+".&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;print("My age is " + age)&lt;/p&gt;

&lt;p&gt;This produces a "TypeError".&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because ""My age is "" is a string and "age" is an integer.&lt;/p&gt;

&lt;p&gt;One solution is to convert the number to a string:&lt;/p&gt;

&lt;p&gt;print("My age is " + str(age))&lt;/p&gt;

&lt;p&gt;But an f-string is usually cleaner:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;print(f"My age is {age}")&lt;/p&gt;

&lt;p&gt;You can also include multiple variables:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;br&gt;
age = 25&lt;/p&gt;

&lt;p&gt;print(f"My name is {name} and I am {age} years old.")&lt;/p&gt;

&lt;p&gt;F-strings are simple and make formatted output much easier to read.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;8. Losing track of a variable's data type&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Python is dynamically typed.&lt;/p&gt;

&lt;p&gt;You don't have to declare a variable's type before assigning a value.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;value = 100&lt;/p&gt;

&lt;p&gt;print(type(value))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;



&lt;p&gt;Later, the same variable can refer to a string:&lt;/p&gt;

&lt;p&gt;value = "Python"&lt;/p&gt;

&lt;p&gt;print(type(value))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;



&lt;p&gt;This flexibility is useful, but it can also cause problems if you lose track of what a variable currently contains.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;value = 100&lt;br&gt;
value = "Python"&lt;/p&gt;

&lt;p&gt;print(value + 10)&lt;/p&gt;

&lt;p&gt;The last line produces a "TypeError" because "value" is currently a string.&lt;/p&gt;

&lt;p&gt;So don't just remember that Python is dynamically typed.&lt;/p&gt;

&lt;p&gt;Also remember:&lt;/p&gt;

&lt;p&gt;Always understand the type of the value your variable currently contains before performing an operation on it.&lt;/p&gt;

&lt;p&gt;When debugging, "type()" can be very useful:&lt;/p&gt;

&lt;p&gt;print(type(value))&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;9. Giving variables vague names&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Python allows short variable names:&lt;/p&gt;

&lt;p&gt;x = 50000&lt;br&gt;
d = 10&lt;/p&gt;

&lt;p&gt;There is nothing syntactically wrong with this.&lt;/p&gt;

&lt;p&gt;But what do "x" and "d" represent?&lt;/p&gt;

&lt;p&gt;Compare them with:&lt;/p&gt;

&lt;p&gt;employee_salary = 50000&lt;br&gt;
number_of_days = 10&lt;/p&gt;

&lt;p&gt;Now the purpose is much clearer.&lt;/p&gt;

&lt;p&gt;Meaningful names become especially important when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the program becomes larger&lt;/li&gt;
&lt;li&gt;several developers work on the same code&lt;/li&gt;
&lt;li&gt;you revisit old code&lt;/li&gt;
&lt;li&gt;you need to debug a problem&lt;/li&gt;
&lt;li&gt;the same type of value is used in several places&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good variable name can often make code easier to understand without adding a comment.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;total_price = 1500&lt;/p&gt;

&lt;p&gt;is easier to understand than:&lt;/p&gt;

&lt;p&gt;tp = 1500&lt;/p&gt;

&lt;p&gt;unless "tp" has a very clear meaning within a small local context.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;10. Getting confused by local and global scope&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Variable scope determines where a variable can be accessed.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;name = "Rahul"&lt;/p&gt;

&lt;p&gt;def show_name():&lt;br&gt;
    name = "Python"&lt;br&gt;
    print(name)&lt;/p&gt;

&lt;p&gt;show_name()&lt;br&gt;
print(name)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
Rahul&lt;/p&gt;

&lt;p&gt;Why are the values different?&lt;/p&gt;

&lt;p&gt;The variable created inside "show_name()" is local to that function.&lt;/p&gt;

&lt;p&gt;The variable created outside the function is in the global scope.&lt;/p&gt;

&lt;p&gt;The local variable does not change the global variable in this example.&lt;/p&gt;

&lt;p&gt;This distinction becomes important as programs start using more functions.&lt;/p&gt;

&lt;p&gt;When debugging a variable-related problem, ask:&lt;/p&gt;

&lt;p&gt;Where was this variable created, and which scope am I currently inside?&lt;/p&gt;

&lt;p&gt;Understanding scope can prevent many confusing bugs.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Quick checklist&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Before running your Python code, take a moment to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did I start variable names correctly?&lt;/li&gt;
&lt;li&gt;Did I accidentally use spaces in a variable name?&lt;/li&gt;
&lt;li&gt;Did I avoid Python keywords?&lt;/li&gt;
&lt;li&gt;Is my capitalization consistent?&lt;/li&gt;
&lt;li&gt;Did I use "=" for assignment and "==" for comparison?&lt;/li&gt;
&lt;li&gt;Did I convert "input()" before performing calculations?&lt;/li&gt;
&lt;li&gt;Am I combining compatible data types?&lt;/li&gt;
&lt;li&gt;Do I know the current type of my variable?&lt;/li&gt;
&lt;li&gt;Are my variable names meaningful?&lt;/li&gt;
&lt;li&gt;Do I understand the variable's scope?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are simple checks, but they can prevent a surprising number of beginner-level errors.&lt;/p&gt;

&lt;p&gt;Try It Yourself&lt;/p&gt;

&lt;p&gt;The best way to understand these concepts is to experiment with the code.&lt;/p&gt;

&lt;p&gt;Try this:&lt;/p&gt;

&lt;p&gt;age = "25"&lt;/p&gt;

&lt;p&gt;print(age + 1)&lt;/p&gt;

&lt;p&gt;You will get a type-related error.&lt;/p&gt;

&lt;p&gt;Now convert the value:&lt;/p&gt;

&lt;p&gt;age = int(age)&lt;/p&gt;

&lt;p&gt;print(age + 1)&lt;/p&gt;

&lt;p&gt;You should now get:&lt;/p&gt;

&lt;p&gt;26&lt;/p&gt;

&lt;p&gt;Try another example:&lt;/p&gt;

&lt;p&gt;value = 100&lt;br&gt;
print(type(value))&lt;/p&gt;

&lt;p&gt;value = "Python"&lt;br&gt;
print(type(value))&lt;/p&gt;

&lt;p&gt;Notice how the type changes.&lt;/p&gt;

&lt;p&gt;You can also experiment with variable names, capitalization, and function scope.&lt;/p&gt;

&lt;p&gt;Don't be afraid of errors while learning Python. A small error followed by understanding the reason behind it is often more useful than simply memorizing the correct syntax.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python variables are easy to create, but there are several details worth understanding early.&lt;/p&gt;

&lt;p&gt;Variable naming rules, assignment, data types, input conversion, meaningful names, and scope all become important as your programs grow.&lt;/p&gt;

&lt;p&gt;You don't need to memorize everything at once.&lt;/p&gt;

&lt;p&gt;Write a small program, make a change, run it, read the error, and try to understand why it happened.&lt;/p&gt;

&lt;p&gt;That habit will help you much more than simply memorizing Python syntax.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Python Basics: 10 Things Every Beginner Should Understand</title>
      <dc:creator>Kailas Warade</dc:creator>
      <pubDate>Tue, 15 Sep 2026 15:04:41 +0000</pubDate>
      <link>https://dev.to/kailas_warade_d2a15d1ef8a/python-basics-10-things-every-beginner-should-understand-5f42</link>
      <guid>https://dev.to/kailas_warade_d2a15d1ef8a/python-basics-10-things-every-beginner-should-understand-5f42</guid>
      <description>&lt;p&gt;*&lt;em&gt;Python Basics: 10 Things Every Beginner Should Understand&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
When someone starts learning Python, the first question is usually:&lt;/p&gt;

&lt;p&gt;“Where should I start?”&lt;/p&gt;

&lt;p&gt;There are so many Python tutorials, courses and videos available that it is easy to get confused.&lt;/p&gt;

&lt;p&gt;Should you learn variables first? Loops? Functions? Pandas? NumPy?&lt;/p&gt;

&lt;p&gt;My suggestion is simple: don't try to learn everything together.&lt;/p&gt;

&lt;p&gt;First, understand the basic ideas behind Python and write small programs. The advanced topics will become much easier later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are 10 Python basics that I recommend every beginner understand.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What can you do with Python?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Python is not only for beginners.&lt;/p&gt;

&lt;p&gt;You can use it for many different types of work, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data analysis&lt;/li&gt;
&lt;li&gt;Data engineering&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Web development&lt;/li&gt;
&lt;li&gt;AI and machine learning&lt;/li&gt;
&lt;li&gt;Scripting&lt;/li&gt;
&lt;li&gt;Scientific computing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, even a small program can process a list of numbers:&lt;/p&gt;

&lt;p&gt;numbers = [10, 20, 30, 40]&lt;/p&gt;

&lt;p&gt;for number in numbers:&lt;br&gt;
    print(number)&lt;/p&gt;

&lt;p&gt;It is a simple example, but it teaches you something important: how Python code is written and how a loop works.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python code is easy to read&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Look at this example:&lt;/p&gt;

&lt;p&gt;name = "John"&lt;br&gt;
age = 25&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(age)&lt;/p&gt;

&lt;p&gt;You can understand what the program is doing without knowing a lot of programming terminology.&lt;/p&gt;

&lt;p&gt;That's helpful when you are learning.&lt;/p&gt;

&lt;p&gt;But don't confuse simple syntax with simple programming. As your programs become bigger, you still need to understand good programming practices.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python does not require you to declare variable types&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In some programming languages, you have to specify the type of a variable.&lt;/p&gt;

&lt;p&gt;Python usually doesn't require that.&lt;/p&gt;

&lt;p&gt;age = 25&lt;br&gt;
name = "John"&lt;br&gt;
salary = 45000.50&lt;/p&gt;

&lt;p&gt;Python knows that "age" is an integer, "name" is a string and "salary" is a float.&lt;/p&gt;

&lt;p&gt;You can check the type yourself:&lt;/p&gt;

&lt;p&gt;age = 25&lt;/p&gt;

&lt;p&gt;print(type(age))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;



&lt;p&gt;Now consider this:&lt;/p&gt;

&lt;p&gt;age = "25"&lt;/p&gt;

&lt;p&gt;Here, "age" contains a string, not an integer.&lt;/p&gt;

&lt;p&gt;So this will not work as you might expect:&lt;/p&gt;

&lt;p&gt;print(age + 5)&lt;/p&gt;

&lt;p&gt;You will get a "TypeError".&lt;/p&gt;

&lt;p&gt;This is why understanding Python data types is important, even when Python makes variable declaration easy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don't ignore indentation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are coming from another programming language, Python indentation may take some time to get used to.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;age = 20&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
    print("You are an adult")&lt;/p&gt;

&lt;p&gt;The spaces before "print()" are important.&lt;/p&gt;

&lt;p&gt;They tell Python that the statement belongs to the "if" block.&lt;/p&gt;

&lt;p&gt;So in Python, indentation is not just about making your code look clean. It is part of the syntax.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A Python program can be just one file&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You don't need a big project to start.&lt;/p&gt;

&lt;p&gt;Create a file called "hello.py":&lt;/p&gt;

&lt;p&gt;print("Hello, Python!")&lt;/p&gt;

&lt;p&gt;Then run it from the command line:&lt;/p&gt;

&lt;p&gt;python hello.py&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;As you become comfortable, you can create scripts for real tasks.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read a CSV file&lt;/li&gt;
&lt;li&gt;Rename files&lt;/li&gt;
&lt;li&gt;Generate a report&lt;/li&gt;
&lt;li&gt;Check data&lt;/li&gt;
&lt;li&gt;Move files from one folder to another&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where Python starts becoming really useful.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is PIP?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will probably hear the word PIP quite often when learning Python.&lt;/p&gt;

&lt;p&gt;PIP is used to install Python packages.&lt;/p&gt;

&lt;p&gt;For example, if you want to work with Pandas, you can install it using:&lt;/p&gt;

&lt;p&gt;pip install pandas&lt;/p&gt;

&lt;p&gt;Then you can use it in your program:&lt;/p&gt;

&lt;p&gt;import pandas as pd&lt;/p&gt;

&lt;p&gt;You don't have to write every feature yourself. Python has a huge collection of packages that you can use in your projects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why do we need a virtual environment?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is something beginners often skip.&lt;/p&gt;

&lt;p&gt;Suppose you have two Python projects.&lt;/p&gt;

&lt;p&gt;One project needs an older version of a package, while another project needs a newer version.&lt;/p&gt;

&lt;p&gt;Installing everything in one common environment can create problems.&lt;/p&gt;

&lt;p&gt;A virtual environment keeps the packages for a project separate.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;python -m venv myenv&lt;/p&gt;

&lt;p&gt;You can then activate the environment and install the packages needed for that particular project.&lt;/p&gt;

&lt;p&gt;You may not need to worry about this for your first small Python program.&lt;/p&gt;

&lt;p&gt;But if you start building real projects, learn virtual environments early.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python is very useful for working with data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are interested in data analytics or data engineering, you will come across Python quite often.&lt;/p&gt;

&lt;p&gt;For example, Pandas can read a CSV file:&lt;/p&gt;

&lt;p&gt;import pandas as pd&lt;/p&gt;

&lt;p&gt;df = pd.read_csv("employees.csv")&lt;/p&gt;

&lt;p&gt;print(df.head())&lt;/p&gt;

&lt;p&gt;Now you have the data in a DataFrame.&lt;/p&gt;

&lt;p&gt;You can then clean it, filter it, calculate values and transform it.&lt;/p&gt;

&lt;p&gt;Some popular Python libraries for data work are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NumPy&lt;/li&gt;
&lt;li&gt;Pandas&lt;/li&gt;
&lt;li&gt;Matplotlib&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need to learn all of them on day one.&lt;/p&gt;

&lt;p&gt;Start with Python basics first.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python is great for automation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Think about a simple situation.&lt;/p&gt;

&lt;p&gt;You receive 500 CSV files and need to perform the same operation on every file.&lt;/p&gt;

&lt;p&gt;Doing it manually would take a lot of time.&lt;/p&gt;

&lt;p&gt;A Python script can do the repetitive work for you.&lt;/p&gt;

&lt;p&gt;Python can be used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read multiple files&lt;/li&gt;
&lt;li&gt;Combine CSV files&lt;/li&gt;
&lt;li&gt;Rename files&lt;/li&gt;
&lt;li&gt;Create reports&lt;/li&gt;
&lt;li&gt;Move files&lt;/li&gt;
&lt;li&gt;Check data&lt;/li&gt;
&lt;li&gt;Perform repetitive tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is one of the areas where even a small amount of Python knowledge can be useful in day-to-day work.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don't learn Python only by watching tutorials&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is probably the most important point.&lt;/p&gt;

&lt;p&gt;You can watch a two-hour Python tutorial and feel like you understand everything.&lt;/p&gt;

&lt;p&gt;Then you open your editor and suddenly don't know what to write.&lt;/p&gt;

&lt;p&gt;That's normal.&lt;/p&gt;

&lt;p&gt;The solution is to start writing small programs.&lt;/p&gt;

&lt;p&gt;For example, try finding the largest number:&lt;/p&gt;

&lt;p&gt;numbers = [10, 50, 30, 80, 40]&lt;/p&gt;

&lt;p&gt;largest = numbers[0]&lt;/p&gt;

&lt;p&gt;for number in numbers:&lt;br&gt;
    if number &amp;gt; largest:&lt;br&gt;
        largest = number&lt;/p&gt;

&lt;p&gt;print(largest)&lt;/p&gt;

&lt;p&gt;The answer is "80".&lt;/p&gt;

&lt;p&gt;Now change the program yourself.&lt;/p&gt;

&lt;p&gt;Try finding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The smallest number&lt;/li&gt;
&lt;li&gt;The second largest number&lt;/li&gt;
&lt;li&gt;The sum of all numbers&lt;/li&gt;
&lt;li&gt;The average&lt;/li&gt;
&lt;li&gt;Numbers greater than 50&lt;/li&gt;
&lt;li&gt;Duplicate values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't worry if your first attempt gives an error.&lt;/p&gt;

&lt;p&gt;The error is part of learning Python.&lt;/p&gt;

&lt;p&gt;What should you learn next?&lt;/p&gt;

&lt;p&gt;After you are comfortable with these basics, move gradually to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strings&lt;/li&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Tuples&lt;/li&gt;
&lt;li&gt;Sets&lt;/li&gt;
&lt;li&gt;Dictionaries&lt;/li&gt;
&lt;li&gt;Conditions&lt;/li&gt;
&lt;li&gt;Loops&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Exception handling&lt;/li&gt;
&lt;li&gt;File handling&lt;/li&gt;
&lt;li&gt;Modules and packages&lt;/li&gt;
&lt;li&gt;Object-oriented programming&lt;/li&gt;
&lt;li&gt;NumPy&lt;/li&gt;
&lt;li&gt;Pandas&lt;/li&gt;
&lt;li&gt;Real Python projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't have to finish all of these before writing projects.&lt;/p&gt;

&lt;p&gt;In fact, writing small projects while learning is a much better way to remember what you learn.&lt;/p&gt;

&lt;p&gt;One more Python resource&lt;/p&gt;

&lt;p&gt;If you are learning Python for interviews or want a quick revision of the basics, I have also prepared a separate guide covering 20 common Python programming questions.&lt;/p&gt;

&lt;p&gt;It covers topics such as Python installation, Python 2 vs Python 3, PIP, virtual environments, dynamic typing, Python scripts, indentation, data analysis, automation and Python's use in AI.&lt;/p&gt;

&lt;p&gt;You can find it here:&lt;/p&gt;

&lt;p&gt;"Introduction to Python Programming: Top 20 Questions Explained" (&lt;a href="https://www.sankalandtech.com/Tutorials/Python/interview-questions/introduction-to-python-programming.html" rel="noopener noreferrer"&gt;https://www.sankalandtech.com/Tutorials/Python/interview-questions/introduction-to-python-programming.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Final thought&lt;/p&gt;

&lt;p&gt;Don't try to become an expert in Python in a few days.&lt;/p&gt;

&lt;p&gt;Learn one concept.&lt;/p&gt;

&lt;p&gt;Write some code.&lt;/p&gt;

&lt;p&gt;Make a mistake.&lt;/p&gt;

&lt;p&gt;Understand the error.&lt;/p&gt;

&lt;p&gt;Try again.&lt;/p&gt;

&lt;p&gt;Then move to the next concept.&lt;/p&gt;

&lt;p&gt;If you do this regularly, Python will become much more comfortable over time.&lt;/p&gt;

&lt;p&gt;And once your basics are strong, you can decide where you want to go next — data analytics, data engineering, automation, AI or machine learning.&lt;/p&gt;

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