<?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: Victor Karanja</title>
    <description>The latest articles on DEV Community by Victor Karanja (@victak36lgtm).</description>
    <link>https://dev.to/victak36lgtm</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%2F3708651%2Fd2e66539-b7bd-4a09-b578-106fcec24dea.jpeg</url>
      <title>DEV Community: Victor Karanja</title>
      <link>https://dev.to/victak36lgtm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victak36lgtm"/>
    <language>en</language>
    <item>
      <title>From Predictions to Better Models: Understanding Regression and Regularization</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Thu, 06 Aug 2026 09:02:48 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/-from-predictions-to-better-models-understanding-regression-and-regularization-b07</link>
      <guid>https://dev.to/victak36lgtm/-from-predictions-to-better-models-understanding-regression-and-regularization-b07</guid>
      <description>&lt;h2&gt;
  
  
  Regression and Regularization: A Beginner's Guide to Building Better Predictive Models
&lt;/h2&gt;

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

&lt;p&gt;In data science, one of the most common tasks is predicting future outcomes using historical data.&lt;/p&gt;

&lt;p&gt;For example, businesses may want to predict:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Future sales&lt;/li&gt;
&lt;li&gt;House prices&lt;/li&gt;
&lt;li&gt;Customer demand&lt;/li&gt;
&lt;li&gt;Employee salaries&lt;/li&gt;
&lt;li&gt;Product performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where &lt;strong&gt;regression&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;Regression is a supervised machine learning technique used to discover relationships between variables and predict continuous numerical values.&lt;/p&gt;

&lt;p&gt;However, as machine learning models become more complex, they can suffer from a problem called &lt;strong&gt;overfitting&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Overfitting happens when a model learns the training data too closely, including unnecessary patterns and noise. As a result, it performs well on training data but poorly on new unseen data.&lt;/p&gt;

&lt;p&gt;To solve this problem, we use &lt;strong&gt;regularization&lt;/strong&gt; — a technique that helps create simpler and more reliable models.&lt;/p&gt;

&lt;p&gt;In this article, we will explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What regression is&lt;/li&gt;
&lt;li&gt;Different types of regression&lt;/li&gt;
&lt;li&gt;The problem of overfitting&lt;/li&gt;
&lt;li&gt;How regularization works&lt;/li&gt;
&lt;li&gt;Ridge, Lasso, and Elastic Net regression&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What is Regression?
&lt;/h2&gt;

&lt;p&gt;Regression is a &lt;strong&gt;supervised learning technique&lt;/strong&gt; that predicts a continuous numerical value based on one or more input variables.&lt;/p&gt;

&lt;p&gt;The model learns the relationship between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Features (input variables)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Target variable (the value we want to predict)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The general structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input Features → Machine Learning Model → Predicted Value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Real-World Example: House Price Prediction
&lt;/h1&gt;

&lt;p&gt;A real estate company can use regression to predict house prices based on factors such as:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;House Size&lt;/td&gt;
&lt;td&gt;2,000 sq ft&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bedrooms&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Location&lt;/td&gt;
&lt;td&gt;Mombasa&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Age of House&lt;/td&gt;
&lt;td&gt;5 years&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bathrooms&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The model studies historical housing data and learns how these factors influence the final price.&lt;/p&gt;

&lt;p&gt;After training, it can estimate the price of a new property.&lt;/p&gt;




&lt;h3&gt;
  
  
  Types of Regression
&lt;/h3&gt;

&lt;h2&gt;
  
  
  1. Linear Regression
&lt;/h2&gt;

&lt;p&gt;Linear Regression is the simplest and most commonly used regression algorithm.&lt;/p&gt;

&lt;p&gt;It assumes that there is a linear relationship between input variables and the target value.&lt;/p&gt;

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

&lt;p&gt;Predicting salary based on years of experience.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LinearRegression&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LinearRegression&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sales forecasting&lt;/li&gt;
&lt;li&gt;Price prediction&lt;/li&gt;
&lt;li&gt;Revenue estimation&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Multiple Linear Regression
&lt;/h3&gt;

&lt;p&gt;Multiple Linear Regression uses multiple input variables to make predictions.&lt;/p&gt;

&lt;p&gt;For example, predicting employee salary using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Education level&lt;/li&gt;
&lt;li&gt;Years of experience&lt;/li&gt;
&lt;li&gt;Job role&lt;/li&gt;
&lt;li&gt;Location&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Education
+
Experience
+
Job Role
        ↓
   Salary Prediction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using multiple features often improves prediction accuracy because real-world problems usually depend on several factors.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Polynomial Regression
&lt;/h3&gt;

&lt;p&gt;Polynomial Regression is used when relationships between variables are more complex and cannot be represented by a straight line.&lt;/p&gt;

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

&lt;p&gt;A company's sales may grow slowly at first, increase rapidly, and then stabilize.&lt;/p&gt;

&lt;p&gt;Polynomial regression can capture these non-linear patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem of Overfitting
&lt;/h2&gt;

&lt;p&gt;Overfitting occurs when a machine learning model learns the training data too closely.&lt;/p&gt;

&lt;p&gt;The model memorizes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Noise&lt;/li&gt;
&lt;li&gt;Random variations&lt;/li&gt;
&lt;li&gt;Unimportant patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of learning the general relationship.&lt;/p&gt;

&lt;p&gt;A typical sign of overfitting:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;Performance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Training Data&lt;/td&gt;
&lt;td&gt;Very High Accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Testing Data&lt;/td&gt;
&lt;td&gt;Poor Accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;A model predicts house prices perfectly for the houses it was trained on but performs badly when predicting prices of new houses.&lt;/p&gt;




&lt;h1&gt;
  
  
  What is Regularization?
&lt;/h1&gt;

&lt;p&gt;Regularization is a technique used to reduce overfitting by adding a penalty term to the model.&lt;/p&gt;

&lt;p&gt;The goal is to encourage the model to become simpler and focus only on important patterns.&lt;/p&gt;

&lt;p&gt;Without regularization:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Complex Model
      ↓
Learns Noise
      ↓
Poor Generalization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With regularization:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Simpler Model
      ↓
Learns Important Patterns
      ↓
Better Predictions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Types of Regularization
&lt;/h2&gt;

&lt;p&gt;There are three common regularization techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ridge Regression (L2)&lt;/li&gt;
&lt;li&gt;Lasso Regression (L1)&lt;/li&gt;
&lt;li&gt;Elastic Net&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Ridge Regression (L2 Regularization)
&lt;/h2&gt;

&lt;p&gt;Ridge regression reduces the impact of less important features by shrinking their coefficients.&lt;/p&gt;

&lt;p&gt;However, it does not completely remove features.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Ridge&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Ridge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ridge is useful when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many features contribute to prediction&lt;/li&gt;
&lt;li&gt;Features are related to each other&lt;/li&gt;
&lt;li&gt;You want to keep all variables&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  2. Lasso Regression (L1 Regularization)
&lt;/h1&gt;

&lt;p&gt;Lasso regression can reduce some feature coefficients to zero.&lt;/p&gt;

&lt;p&gt;This means it can automatically remove less important features.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Lasso&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Lasso&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lasso is useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Feature selection&lt;/li&gt;
&lt;li&gt;Reducing unnecessary variables&lt;/li&gt;
&lt;li&gt;Creating simpler models&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. Elastic Net Regression
&lt;/h1&gt;

&lt;p&gt;Elastic Net combines both Ridge and Lasso techniques.&lt;/p&gt;

&lt;p&gt;It provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ridge's ability to handle correlated features&lt;/li&gt;
&lt;li&gt;Lasso's ability to remove unnecessary features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Elastic Net is useful when working with large datasets containing many variables.&lt;/p&gt;




&lt;h1&gt;
  
  
  Regression vs Regularization
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Regression&lt;/th&gt;
&lt;th&gt;Regularization&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Used to predict numerical values&lt;/td&gt;
&lt;td&gt;Used to improve model performance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learns relationships between variables&lt;/td&gt;
&lt;td&gt;Controls model complexity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minimizes prediction errors&lt;/td&gt;
&lt;td&gt;Reduces overfitting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can become complex with many features&lt;/td&gt;
&lt;td&gt;Creates simpler models&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  How Regression and Regularization Work Together
&lt;/h1&gt;

&lt;p&gt;Regression helps us answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What value should we predict?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Regularization helps us answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How can we make our model more reliable?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Together, they help build machine learning models that perform well not only on training data but also on real-world data.&lt;/p&gt;




&lt;h1&gt;
  
  
  When Should You Use Regularization?
&lt;/h1&gt;

&lt;p&gt;Regularization is especially useful when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your dataset has many features&lt;/li&gt;
&lt;li&gt;Your model performs much better on training data than testing data&lt;/li&gt;
&lt;li&gt;You want better generalization&lt;/li&gt;
&lt;li&gt;You are working with complex models&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Regression is one of the most important techniques in machine learning because it allows us to predict continuous numerical outcomes.&lt;/p&gt;

&lt;p&gt;However, powerful models can easily become too complex and overfit the training data.&lt;/p&gt;

&lt;p&gt;Regularization solves this problem by adding constraints that encourage simpler and more general models.&lt;/p&gt;

&lt;p&gt;Understanding regression and regularization provides a strong foundation for building reliable machine learning solutions in areas such as finance, healthcare, marketing, and business analytics.&lt;/p&gt;

&lt;p&gt;As you continue learning machine learning, remember:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A good model is not the one that memorizes data — it is the one that learns patterns and performs well on new data.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>From SQL to Power BI: Building Your First Connected Dashboard</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Thu, 06 Aug 2026 08:55:05 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/from-sql-to-power-bi-building-your-first-connected-dashboard-5h44</link>
      <guid>https://dev.to/victak36lgtm/from-sql-to-power-bi-building-your-first-connected-dashboard-5h44</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Modern organizations generate and store huge amounts of data every day. This information may come from sales transactions, customers, inventory systems, websites, and business applications.&lt;/p&gt;

&lt;p&gt;However, storing data is only the first step. The real value comes from transforming raw data into meaningful insights that support better decision-making.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;SQL databases&lt;/strong&gt; and &lt;strong&gt;Microsoft Power BI&lt;/strong&gt; work together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt; allows analysts to access, query, and prepare data stored in databases, while &lt;strong&gt;Power BI&lt;/strong&gt; helps transform that data into interactive dashboards and reports.&lt;/p&gt;

&lt;p&gt;In this article, we will explore how to connect Power BI to a SQL database, using &lt;strong&gt;PostgreSQL&lt;/strong&gt; as an example, both locally and through a cloud database such as &lt;strong&gt;Aiven PostgreSQL&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By the end of this guide, you will understand how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect Power BI to PostgreSQL&lt;/li&gt;
&lt;li&gt;Import database tables&lt;/li&gt;
&lt;li&gt;Understand Import and DirectQuery modes&lt;/li&gt;
&lt;li&gt;Connect to cloud databases securely&lt;/li&gt;
&lt;li&gt;Model data relationships&lt;/li&gt;
&lt;li&gt;Prepare data for dashboard creation&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Understanding the Data Workflow
&lt;/h1&gt;

&lt;p&gt;A typical data analytics workflow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SQL Database
      │
      ▼
SQL Queries
      │
      ▼
Clean Dataset
      │
      ▼
Power BI Connection
      │
      ▼
Data Modeling
      │
      ▼
Interactive Dashboard
      │
      ▼
Business Insights
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A database stores the information, SQL prepares the data, and Power BI turns it into visual stories.&lt;/p&gt;




&lt;h1&gt;
  
  
  What is Power BI?
&lt;/h1&gt;

&lt;p&gt;Microsoft Power BI is a business intelligence and data visualization platform used to analyze data and create interactive reports and dashboards.&lt;/p&gt;

&lt;p&gt;Organizations use Power BI to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitor business performance&lt;/li&gt;
&lt;li&gt;Analyze trends&lt;/li&gt;
&lt;li&gt;Track key performance indicators (KPIs)&lt;/li&gt;
&lt;li&gt;Create automated reports&lt;/li&gt;
&lt;li&gt;Support strategic decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Power BI connects to many different data sources, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL databases&lt;/li&gt;
&lt;li&gt;Excel files&lt;/li&gt;
&lt;li&gt;CSV files&lt;/li&gt;
&lt;li&gt;Cloud databases&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Data warehouses&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Why Connect Power BI to a SQL Database?
&lt;/h1&gt;

&lt;p&gt;Connecting Power BI directly to a database provides several advantages:&lt;/p&gt;

&lt;h2&gt;
  
  
  Access to Real-Time Data
&lt;/h2&gt;

&lt;p&gt;Dashboards can reflect updated information from the organization's database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Data Analysis
&lt;/h2&gt;

&lt;p&gt;Analysts can combine SQL queries with Power BI features to perform deeper analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automated Reporting
&lt;/h2&gt;

&lt;p&gt;Reports can refresh automatically without manually updating files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better Decision Making
&lt;/h2&gt;

&lt;p&gt;Clean and visualized data helps organizations make informed decisions.&lt;/p&gt;




&lt;h1&gt;
  
  
  Connecting Power BI to a Local PostgreSQL Database
&lt;/h1&gt;

&lt;p&gt;PostgreSQL is one of the most popular open-source relational database management systems.&lt;/p&gt;

&lt;p&gt;Connecting Power BI to a local PostgreSQL database requires only a few steps.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 1: Launch Power BI Desktop
&lt;/h1&gt;

&lt;p&gt;Open &lt;strong&gt;Power BI Desktop&lt;/strong&gt; on your computer.&lt;/p&gt;

&lt;p&gt;From the Home menu, select:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Home → Get Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Step 2: Select PostgreSQL Database Connector
&lt;/h1&gt;

&lt;p&gt;From the available data sources, choose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PostgreSQL Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Power BI provides connectors for many database systems.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 3: Enter Connection Details
&lt;/h1&gt;

&lt;p&gt;A connection window will appear.&lt;/p&gt;

&lt;p&gt;Enter your PostgreSQL database information.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server:
localhost

Database:
SalesDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server name identifies where the database is running, while the database name identifies the specific database you want to connect to.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 4: Choose Connection Mode
&lt;/h1&gt;

&lt;p&gt;Power BI provides two main connection options:&lt;/p&gt;

&lt;h2&gt;
  
  
  Import Mode
&lt;/h2&gt;

&lt;p&gt;Data is loaded into Power BI's memory.&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster dashboard performance&lt;/li&gt;
&lt;li&gt;Better for smaller and medium-sized datasets&lt;/li&gt;
&lt;li&gt;Allows offline analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DirectQuery Mode
&lt;/h2&gt;

&lt;p&gt;Power BI sends queries directly to the database.&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Near real-time data&lt;/li&gt;
&lt;li&gt;Useful for large databases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance depends on database speed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For beginners and portfolio projects, &lt;strong&gt;Import Mode&lt;/strong&gt; is usually the best option.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 5: Enter PostgreSQL Login Details
&lt;/h1&gt;

&lt;p&gt;Provide your database credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Username

Password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After successful authentication, Power BI will connect to your database.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 6: Load Tables into Power BI
&lt;/h1&gt;

&lt;p&gt;The Navigator window will appear.&lt;/p&gt;

&lt;p&gt;Select the tables you need.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;☑ Customers

☑ Products

☑ Sales

☑ Inventory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Your PostgreSQL data is now available inside Power BI.&lt;/p&gt;




&lt;h1&gt;
  
  
  Connecting Power BI to a Cloud PostgreSQL Database (Aiven)
&lt;/h1&gt;

&lt;p&gt;Many organizations use cloud databases instead of local servers.&lt;/p&gt;

&lt;p&gt;Aiven PostgreSQL provides managed PostgreSQL databases hosted in the cloud.&lt;/p&gt;

&lt;p&gt;Connecting to a cloud database requires additional security settings.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 1: Collect Database Connection Information
&lt;/h1&gt;

&lt;p&gt;From your Aiven dashboard, collect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host name&lt;/li&gt;
&lt;li&gt;Port number&lt;/li&gt;
&lt;li&gt;Database name&lt;/li&gt;
&lt;li&gt;Username&lt;/li&gt;
&lt;li&gt;Password&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host:
your-database-host

Port:
5432

Database:
sales_database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Step 2: Download SSL Certificate
&lt;/h1&gt;

&lt;p&gt;Cloud databases require secure connections.&lt;/p&gt;

&lt;p&gt;Aiven uses SSL certificates to protect communication between applications and databases.&lt;/p&gt;

&lt;p&gt;The certificate can be downloaded from the Aiven console.&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 3: Connect Power BI to Aiven PostgreSQL
&lt;/h1&gt;

&lt;p&gt;In Power BI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Home
 ↓
Get Data
 ↓
PostgreSQL Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server:
Host + Port

Database:
Database Name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Step 4: Configure Secure Connection
&lt;/h1&gt;

&lt;p&gt;Provide the required authentication information.&lt;/p&gt;

&lt;p&gt;SSL provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encryption of data during transmission&lt;/li&gt;
&lt;li&gt;Protection against unauthorized access&lt;/li&gt;
&lt;li&gt;Verification between client and server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without encryption, sensitive business information could be exposed during transfer.&lt;/p&gt;




&lt;h1&gt;
  
  
  Loading Data and Creating a Data Model
&lt;/h1&gt;

&lt;p&gt;After connecting successfully, Power BI can load tables such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customers&lt;/li&gt;
&lt;li&gt;Products&lt;/li&gt;
&lt;li&gt;Sales&lt;/li&gt;
&lt;li&gt;Inventory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A professional dashboard requires a proper data model.&lt;/p&gt;




&lt;h1&gt;
  
  
  Understanding Data Relationships
&lt;/h1&gt;

&lt;p&gt;Relational databases usually contain multiple connected tables.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customers
    |
    |
Customer_ID
    |
    |
Sales
    |
    |
Product_ID
    |
    |
Products
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Customers → Sales
&lt;/h3&gt;

&lt;p&gt;Connected using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Products → Sales
&lt;/h3&gt;

&lt;p&gt;Connected using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Products → Inventory
&lt;/h3&gt;

&lt;p&gt;Connected using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  Key Data Modeling Concepts
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Primary Key
&lt;/h2&gt;

&lt;p&gt;A primary key uniquely identifies every record in a table.&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Foreign Key
&lt;/h2&gt;

&lt;p&gt;A foreign key connects one table to another.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer_ID in Sales Table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Relationships
&lt;/h2&gt;

&lt;p&gt;Relationships allow Power BI to correctly filter and aggregate information.&lt;/p&gt;

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

&lt;p&gt;A sales dashboard can show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Revenue by customer&lt;/li&gt;
&lt;li&gt;Sales by product&lt;/li&gt;
&lt;li&gt;Inventory levels&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Creating Your First Dashboard
&lt;/h1&gt;

&lt;p&gt;Once the data model is ready, you can create visual reports.&lt;/p&gt;

&lt;p&gt;Common Power BI visuals include:&lt;/p&gt;

&lt;h2&gt;
  
  
  Cards
&lt;/h2&gt;

&lt;p&gt;Display important numbers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total Sales&lt;/li&gt;
&lt;li&gt;Total Customers&lt;/li&gt;
&lt;li&gt;Total Profit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bar Charts
&lt;/h2&gt;

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

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sales by Product Category
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Line Charts
&lt;/h2&gt;

&lt;p&gt;Analyze trends:&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Monthly Revenue Growth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Maps
&lt;/h2&gt;

&lt;p&gt;Analyze geographical information:&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sales by Region
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Using SQL Queries Before Loading Data
&lt;/h1&gt;

&lt;p&gt;Instead of importing entire tables, analysts can write SQL queries to prepare data.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;product_category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales_amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;product_category&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster reports&lt;/li&gt;
&lt;li&gt;Cleaner datasets&lt;/li&gt;
&lt;li&gt;Reduced transformation work&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Common Connection Problems
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Authentication Errors
&lt;/h2&gt;

&lt;p&gt;Check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Username&lt;/li&gt;
&lt;li&gt;Password&lt;/li&gt;
&lt;li&gt;Database permissions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Server Not Found
&lt;/h2&gt;

&lt;p&gt;Verify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server address&lt;/li&gt;
&lt;li&gt;Port number&lt;/li&gt;
&lt;li&gt;Database status&lt;/li&gt;
&lt;li&gt;Network connection&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Slow Dashboards
&lt;/h2&gt;

&lt;p&gt;Improve performance by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Removing unnecessary columns&lt;/li&gt;
&lt;li&gt;Optimizing SQL queries&lt;/li&gt;
&lt;li&gt;Creating proper data models&lt;/li&gt;
&lt;li&gt;Avoiding unnecessary visuals&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Best Practices for Power BI and SQL Projects
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Clean Data Before Visualization
&lt;/h2&gt;

&lt;p&gt;Good dashboards require accurate and reliable data.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Build Proper Relationships
&lt;/h2&gt;

&lt;p&gt;Avoid combining everything into one large table.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Write Efficient SQL Queries
&lt;/h2&gt;

&lt;p&gt;Only retrieve the data needed for analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep Dashboards Simple
&lt;/h2&gt;

&lt;p&gt;Focus on answering business questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Document Your Work
&lt;/h2&gt;

&lt;p&gt;Include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data source&lt;/li&gt;
&lt;li&gt;SQL queries&lt;/li&gt;
&lt;li&gt;Data cleaning steps&lt;/li&gt;
&lt;li&gt;Dashboard purpose&lt;/li&gt;
&lt;li&gt;Business insights&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Conclusion: Why SQL Skills Matter for Power BI Analysts
&lt;/h1&gt;

&lt;p&gt;SQL is one of the most important skills for Power BI analysts.&lt;/p&gt;

&lt;p&gt;Although Power BI provides powerful visualization tools, SQL gives analysts direct control over the data behind their reports.&lt;/p&gt;

&lt;p&gt;With SQL, analysts can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query required datasets&lt;/li&gt;
&lt;li&gt;Filter information&lt;/li&gt;
&lt;li&gt;Perform calculations such as SUM, COUNT, and AVG&lt;/li&gt;
&lt;li&gt;Combine multiple tables&lt;/li&gt;
&lt;li&gt;Prepare clean datasets for visualization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining &lt;strong&gt;SQL + PostgreSQL + Power BI&lt;/strong&gt;, analysts can transform raw database records into meaningful dashboards that support business decisions.&lt;/p&gt;

&lt;p&gt;The journey from SQL to Power BI is not only about creating attractive charts — it is about turning data into insights.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Getting Started with Machine Learning: A Complete Beginner's Guide</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Thu, 06 Aug 2026 08:29:40 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/getting-started-with-machine-learning-a-complete-beginners-guide-ca8</link>
      <guid>https://dev.to/victak36lgtm/getting-started-with-machine-learning-a-complete-beginners-guide-ca8</guid>
      <description>&lt;h1&gt;
  
  
  Machine Learning Explained: Understanding the Different Types of Machine Learning
&lt;/h1&gt;

&lt;p&gt;Machine Learning (ML) has become one of the most transformative technologies of the modern era. Every time Netflix recommends a movie, Spotify suggests a playlist, Google Maps finds the fastest route, or your bank flags a suspicious transaction, machine learning is working behind the scenes.&lt;/p&gt;

&lt;p&gt;As the amount of data generated worldwide continues to grow, organizations rely on machine learning to analyze information, identify patterns, make predictions, and automate decision-making.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore what machine learning is, why it matters, the four main types of machine learning, and the typical workflow followed in real-world machine learning projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Machine Learning?
&lt;/h2&gt;

&lt;p&gt;Machine Learning is a branch of &lt;strong&gt;Artificial Intelligence (AI)&lt;/strong&gt; that enables computers to learn from data without being explicitly programmed for every task.&lt;/p&gt;

&lt;p&gt;Unlike traditional programming, where developers write fixed rules, machine learning algorithms discover those rules by analyzing historical data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional Programming
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rules + Data
      │
      ▼
   Output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, a developer can write rules to calculate taxes based on income.&lt;/p&gt;

&lt;h3&gt;
  
  
  Machine Learning
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Historical Data + Expected Results
               │
               ▼
      Machine Learning Algorithm
               │
               ▼
         Trained Model
               │
               ▼
     Predictions on New Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of writing every rule manually, we provide examples. The algorithm learns patterns from those examples and uses them to make predictions on new data.&lt;/p&gt;

&lt;p&gt;For instance, rather than programming every characteristic of a spam email, we train a model using thousands of labeled emails. The model learns which features indicate spam and can classify future emails automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why is Machine Learning Important?
&lt;/h2&gt;

&lt;p&gt;Machine learning helps organizations make smarter decisions by uncovering insights hidden within data.&lt;/p&gt;

&lt;p&gt;Some common applications include:&lt;/p&gt;

&lt;h3&gt;
  
  
  🎬 Recommendation Systems
&lt;/h3&gt;

&lt;p&gt;Streaming platforms and online stores recommend movies, music, videos, and products based on user preferences and previous interactions.&lt;/p&gt;

&lt;h3&gt;
  
  
  🏥 Healthcare
&lt;/h3&gt;

&lt;p&gt;Machine learning assists healthcare professionals by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting diseases&lt;/li&gt;
&lt;li&gt;Analyzing medical images&lt;/li&gt;
&lt;li&gt;Predicting patient risk&lt;/li&gt;
&lt;li&gt;Supporting diagnosis&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💳 Finance
&lt;/h3&gt;

&lt;p&gt;Financial institutions use machine learning for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fraud detection&lt;/li&gt;
&lt;li&gt;Credit scoring&lt;/li&gt;
&lt;li&gt;Risk analysis&lt;/li&gt;
&lt;li&gt;Market forecasting&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🚗 Transportation
&lt;/h3&gt;

&lt;p&gt;Self-driving vehicles use machine learning to recognize road signs, detect pedestrians, and navigate safely.&lt;/p&gt;

&lt;h3&gt;
  
  
  📈 Marketing
&lt;/h3&gt;

&lt;p&gt;Businesses analyze customer behavior to deliver personalized advertisements and improve customer engagement.&lt;/p&gt;




&lt;h1&gt;
  
  
  Types of Machine Learning
&lt;/h1&gt;

&lt;p&gt;Machine learning can be divided into four major categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supervised Learning&lt;/li&gt;
&lt;li&gt;Unsupervised Learning&lt;/li&gt;
&lt;li&gt;Semi-Supervised Learning&lt;/li&gt;
&lt;li&gt;Reinforcement Learning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each type differs in the way it learns from data and the type of problems it solves.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Supervised Learning
&lt;/h1&gt;

&lt;p&gt;Supervised learning is the most commonly used type of machine learning.&lt;/p&gt;

&lt;p&gt;In supervised learning, the training data contains both the input data and the correct output (also known as labels). The algorithm learns the relationship between the inputs and outputs so it can make predictions for new data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: Predicting House Prices in Mombasa
&lt;/h2&gt;

&lt;p&gt;Suppose we want to build a machine learning model that predicts house prices in &lt;strong&gt;Mombasa, Kenya&lt;/strong&gt; using historical housing data.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;House Size (sq ft)&lt;/th&gt;
&lt;th&gt;Bedrooms&lt;/th&gt;
&lt;th&gt;Bathrooms&lt;/th&gt;
&lt;th&gt;Age (Years)&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Price (USD)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;980&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;Nyali&lt;/td&gt;
&lt;td&gt;$92,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,450&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Bamburi&lt;/td&gt;
&lt;td&gt;$138,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,850&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Shanzu&lt;/td&gt;
&lt;td&gt;$198,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2,300&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Nyali&lt;/td&gt;
&lt;td&gt;$285,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3,100&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Mtwapa&lt;/td&gt;
&lt;td&gt;$465,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The model learns how features such as &lt;strong&gt;house size&lt;/strong&gt;, &lt;strong&gt;number of bedrooms&lt;/strong&gt;, &lt;strong&gt;bathrooms&lt;/strong&gt;, &lt;strong&gt;property age&lt;/strong&gt;, and &lt;strong&gt;location&lt;/strong&gt; influence selling price.&lt;/p&gt;

&lt;p&gt;After training, it can estimate the value of a new property.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example Prediction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A house in &lt;strong&gt;Nyali&lt;/strong&gt; with &lt;strong&gt;2,000 sq ft&lt;/strong&gt;, &lt;strong&gt;4 bedrooms&lt;/strong&gt;, &lt;strong&gt;3 bathrooms&lt;/strong&gt;, and &lt;strong&gt;4 years&lt;/strong&gt; of age may be predicted to sell for approximately &lt;strong&gt;$235,000&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Types of Supervised Learning
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Regression
&lt;/h3&gt;

&lt;p&gt;Regression predicts continuous numerical values.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;House price prediction&lt;/li&gt;
&lt;li&gt;Sales forecasting&lt;/li&gt;
&lt;li&gt;Temperature prediction&lt;/li&gt;
&lt;li&gt;Stock price forecasting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common regression algorithms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linear Regression&lt;/li&gt;
&lt;li&gt;Decision Tree Regression&lt;/li&gt;
&lt;li&gt;Random Forest Regression&lt;/li&gt;
&lt;li&gt;Support Vector Regression&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LinearRegression&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LinearRegression&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Classification
&lt;/h3&gt;

&lt;p&gt;Classification predicts categories instead of numbers.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spam or Not Spam&lt;/li&gt;
&lt;li&gt;Fraud or Legitimate Transaction&lt;/li&gt;
&lt;li&gt;Disease Positive or Negative&lt;/li&gt;
&lt;li&gt;Customer Will Buy or Will Not Buy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Popular classification algorithms include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logistic Regression&lt;/li&gt;
&lt;li&gt;Decision Trees&lt;/li&gt;
&lt;li&gt;Random Forest&lt;/li&gt;
&lt;li&gt;Support Vector Machines (SVM)&lt;/li&gt;
&lt;li&gt;Neural Networks&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;A bank can automatically determine whether a transaction is fraudulent.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Unsupervised Learning
&lt;/h1&gt;

&lt;p&gt;Unlike supervised learning, &lt;strong&gt;unsupervised learning&lt;/strong&gt; works with &lt;strong&gt;unlabeled data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The algorithm receives data without predefined answers and discovers hidden patterns or structures on its own.&lt;/p&gt;

&lt;p&gt;For example, a retail company may have thousands of customer records but no predefined customer groups. An unsupervised learning algorithm can automatically identify customers with similar purchasing behaviors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clustering
&lt;/h2&gt;

&lt;p&gt;Clustering groups similar observations together.&lt;/p&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer segmentation&lt;/li&gt;
&lt;li&gt;Document grouping&lt;/li&gt;
&lt;li&gt;Community detection&lt;/li&gt;
&lt;li&gt;Market research&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Popular clustering algorithms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;K-Means&lt;/li&gt;
&lt;li&gt;Hierarchical Clustering&lt;/li&gt;
&lt;li&gt;DBSCAN&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;A supermarket might automatically group customers into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequent buyers&lt;/li&gt;
&lt;li&gt;Occasional buyers&lt;/li&gt;
&lt;li&gt;High-value customers&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Dimensionality Reduction
&lt;/h2&gt;

&lt;p&gt;Real-world datasets often contain hundreds of variables.&lt;/p&gt;

&lt;p&gt;Dimensionality reduction simplifies datasets while preserving the most important information.&lt;/p&gt;

&lt;p&gt;Popular techniques include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Principal Component Analysis (PCA)&lt;/li&gt;
&lt;li&gt;t-SNE&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data visualization&lt;/li&gt;
&lt;li&gt;Faster model training&lt;/li&gt;
&lt;li&gt;Noise reduction&lt;/li&gt;
&lt;li&gt;Feature selection&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. Semi-Supervised Learning
&lt;/h1&gt;

&lt;p&gt;Semi-supervised learning combines supervised and unsupervised learning.&lt;/p&gt;

&lt;p&gt;It uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A small amount of labeled data&lt;/li&gt;
&lt;li&gt;A large amount of unlabeled data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since labeling data is often expensive and time-consuming, this approach helps reduce costs while maintaining good model performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Suppose a company wants to build an image recognition system with one million images.&lt;/p&gt;

&lt;p&gt;Instead of labeling every image manually, it labels only a small percentage. The algorithm then learns from both the labeled and unlabeled images.&lt;/p&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image classification&lt;/li&gt;
&lt;li&gt;Speech recognition&lt;/li&gt;
&lt;li&gt;Medical image analysis&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  4. Reinforcement Learning
&lt;/h1&gt;

&lt;p&gt;Reinforcement learning teaches an agent to make decisions by interacting with an environment.&lt;/p&gt;

&lt;p&gt;The agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes an action&lt;/li&gt;
&lt;li&gt;Receives a reward or penalty&lt;/li&gt;
&lt;li&gt;Learns from the outcome&lt;/li&gt;
&lt;li&gt;Improves future decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The objective is to maximize long-term rewards.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Imagine teaching a robot to navigate a room.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moving safely earns a reward.&lt;/li&gt;
&lt;li&gt;Hitting an obstacle results in a penalty.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over time, the robot discovers the safest and most efficient route.&lt;/p&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Robotics&lt;/li&gt;
&lt;li&gt;Video games&lt;/li&gt;
&lt;li&gt;Autonomous vehicles&lt;/li&gt;
&lt;li&gt;Resource optimization&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Typical Machine Learning Workflow
&lt;/h1&gt;

&lt;p&gt;Most machine learning projects follow these six steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Data Collection
&lt;/h3&gt;

&lt;p&gt;Gather relevant data from databases, APIs, sensors, surveys, websites, or spreadsheets.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Data Cleaning
&lt;/h3&gt;

&lt;p&gt;Prepare the dataset by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Removing duplicates&lt;/li&gt;
&lt;li&gt;Handling missing values&lt;/li&gt;
&lt;li&gt;Correcting errors&lt;/li&gt;
&lt;li&gt;Standardizing formats&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Feature Selection
&lt;/h3&gt;

&lt;p&gt;Choose the variables that provide the most useful information for making predictions.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Model Training
&lt;/h3&gt;

&lt;p&gt;Train a machine learning algorithm using historical data.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Model Evaluation
&lt;/h3&gt;

&lt;p&gt;Evaluate model performance using metrics such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accuracy&lt;/li&gt;
&lt;li&gt;Precision&lt;/li&gt;
&lt;li&gt;Recall&lt;/li&gt;
&lt;li&gt;F1 Score&lt;/li&gt;
&lt;li&gt;Mean Squared Error (MSE)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Model Deployment
&lt;/h3&gt;

&lt;p&gt;Deploy the trained model into a real-world application where it can make predictions on new data.&lt;/p&gt;




&lt;h1&gt;
  
  
  Challenges in Machine Learning
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Poor Data Quality
&lt;/h3&gt;

&lt;p&gt;Poor-quality data leads to poor predictions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Garbage in, garbage out.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Overfitting
&lt;/h3&gt;

&lt;p&gt;Overfitting occurs when a model memorizes the training data instead of learning general patterns, resulting in poor performance on unseen data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bias
&lt;/h3&gt;

&lt;p&gt;If the training data contains bias, the model may produce unfair or inaccurate predictions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Computing Requirements
&lt;/h3&gt;

&lt;p&gt;Large machine learning models often require significant computational resources, especially when training on massive datasets.&lt;/p&gt;




&lt;h1&gt;
  
  
  Artificial Intelligence vs Machine Learning
&lt;/h1&gt;

&lt;p&gt;Although these terms are often used interchangeably, they are not the same.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Artificial Intelligence (AI)&lt;/strong&gt; is the broader field focused on creating systems that can perform tasks requiring human intelligence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine Learning (ML)&lt;/strong&gt; is a subset of AI that enables systems to learn from data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deep Learning (DL)&lt;/strong&gt; is a specialized branch of machine learning that uses artificial neural networks to solve highly complex problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Their relationship can be summarized as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Artificial Intelligence
        │
        ▼
Machine Learning
        │
        ▼
Deep Learning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Key Takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Machine Learning enables computers to learn patterns from data without explicit programming.&lt;/li&gt;
&lt;li&gt;The four main types of machine learning are Supervised, Unsupervised, Semi-Supervised, and Reinforcement Learning.&lt;/li&gt;
&lt;li&gt;High-quality data is essential for building accurate models.&lt;/li&gt;
&lt;li&gt;A typical machine learning project involves data collection, cleaning, feature selection, training, evaluation, and deployment.&lt;/li&gt;
&lt;li&gt;Machine learning powers applications in healthcare, finance, transportation, marketing, and many other industries.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Machine learning is transforming how we solve real-world problems by turning data into actionable insights. From predicting house prices and detecting fraudulent transactions to powering recommendation systems and autonomous vehicles, its applications continue to expand across industries.&lt;/p&gt;

&lt;p&gt;Understanding the different types of machine learning provides a solid foundation for anyone beginning a journey in data science or artificial intelligence. As you continue learning, focus on practicing with real datasets, experimenting with different algorithms, and building projects that reinforce these concepts. Hands-on experience is the best way to develop practical machine learning skills.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python for Beginners (Part 2): Mastering Python Fundamentals</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Mon, 27 Jul 2026 06:30:16 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/python-for-beginners-part-2-mastering-python-fundamentals-4i6n</link>
      <guid>https://dev.to/victak36lgtm/python-for-beginners-part-2-mastering-python-fundamentals-4i6n</guid>
      <description>&lt;p&gt;Welcome back!&lt;br&gt;&lt;br&gt;
In Part 1 we learned variables and how to print information. Now it’s time to make our programs smarter and more useful.&lt;/p&gt;

&lt;p&gt;In this part you will learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comparison operators
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;if&lt;/code&gt;, &lt;code&gt;elif&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; loops
&lt;/li&gt;
&lt;li&gt;Functions
&lt;/li&gt;
&lt;li&gt;Lists
&lt;/li&gt;
&lt;li&gt;Dictionaries
&lt;/li&gt;
&lt;li&gt;A complete Student Grade Calculator project
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s get started.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Comparison Operators
&lt;/h3&gt;

&lt;p&gt;Comparison operators check the relationship between two values and return &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;# True  (greater than)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;# False (less than)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# False (equal to)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# True  (not equal to)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# True  (greater than or equal)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# False (less than or equal)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These operators are the foundation of decision-making in Python.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. if, elif, and else
&lt;/h3&gt;

&lt;p&gt;These statements let your program choose different actions based on conditions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;85&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grade A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grade B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grade C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grade D&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;if&lt;/code&gt; checks the first condition&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;elif&lt;/code&gt; checks the next condition only if the previous ones were False&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;else&lt;/code&gt; runs when none of the conditions are True&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Always remember to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Put a colon &lt;code&gt;:&lt;/code&gt; at the end of each condition&lt;/li&gt;
&lt;li&gt;Indent the code under each block (4 spaces)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. for and while Loops
&lt;/h3&gt;

&lt;p&gt;Loops allow you to repeat code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;for loop&lt;/strong&gt; – best when you know how many times to repeat:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0
1
2
3
4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;while loop&lt;/strong&gt; – best when you want to keep repeating as long as a condition is True:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0
1
2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Extra tools:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;break&lt;/code&gt; → stop the loop immediately&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;continue&lt;/code&gt; → skip the rest of the current loop and move to the next one&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Functions
&lt;/h3&gt;

&lt;p&gt;Functions help you write reusable code. You define it once and use it many times.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alex&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sam&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also return a value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 15
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Lists
&lt;/h3&gt;

&lt;p&gt;A list stores multiple items in a specific order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;apple&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;banana&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;orange&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;          &lt;span class="c1"&gt;# apple
&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mango&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;# add a new item
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;        &lt;span class="c1"&gt;# 4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also loop through a list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;fruit&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Dictionaries
&lt;/h3&gt;

&lt;p&gt;A dictionary stores data as key-value pairs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;student&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alex&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;grade&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;     &lt;span class="c1"&gt;# Alex
&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;grade&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;     &lt;span class="c1"&gt;# update a value
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Mini Project: Student Grade Calculator
&lt;/h3&gt;

&lt;p&gt;Now let’s combine everything we learned into a small real project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_grade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;D&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;F&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# List of students (each student is a dictionary)
&lt;/span&gt;&lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alex&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sam&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Jordan&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Taylor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Student Grade Report&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-------------------&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;student&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;grade&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;calculate_grade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; → Grade &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;grade&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student Grade Report
-------------------
Alex: 92 → Grade A
Sam: 78 → Grade C
Jordan: 65 → Grade D
Taylor: 55 → Grade F
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What You Learned Today
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How to compare values
&lt;/li&gt;
&lt;li&gt;How to make decisions with &lt;code&gt;if / elif / else&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;How to repeat actions with loops
&lt;/li&gt;
&lt;li&gt;How to create reusable functions
&lt;/li&gt;
&lt;li&gt;How to store data with lists and dictionaries
&lt;/li&gt;
&lt;li&gt;How to build a complete mini project
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great work!&lt;br&gt;&lt;br&gt;
Try changing the scores or adding more students to practice. The more you experiment, the faster you will improve.&lt;/p&gt;

&lt;p&gt;See you in the next part!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python for Beginners (Part 1): From Zero to Writing Your First Programs</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Mon, 27 Jul 2026 06:21:00 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/python-for-beginners-part-1-from-zero-to-writing-your-first-programs-2ahk</link>
      <guid>https://dev.to/victak36lgtm/python-for-beginners-part-1-from-zero-to-writing-your-first-programs-2ahk</guid>
      <description>&lt;h1&gt;
  
  
  Python for Beginners (Part 1): From Zero to Writing Your First Programs
&lt;/h1&gt;

&lt;p&gt;Python is one of the most beginner-friendly programming languages in the world. Whether you want to become a data analyst, data scientist, backend developer, automation engineer, or AI engineer, Python is an excellent place to start.&lt;/p&gt;

&lt;p&gt;In this first part of the series, you'll learn the fundamentals you need before moving on to decision-making, loops, and functions in Part 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Learn Python?
&lt;/h2&gt;

&lt;p&gt;Python is known for its simple syntax, making it easy to read and write. It is used in many fields, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Analysis&lt;/li&gt;
&lt;li&gt;Artificial Intelligence and Machine Learning&lt;/li&gt;
&lt;li&gt;Web Development&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Cybersecurity&lt;/li&gt;
&lt;li&gt;Scientific Computing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you've never written code before, don't worry. We'll take it one step at a time.&lt;/p&gt;




&lt;h1&gt;
  
  
  Installing Python
&lt;/h1&gt;

&lt;p&gt;Download the latest version of Python from the official website.&lt;/p&gt;

&lt;p&gt;During installation on Windows, remember to check &lt;strong&gt;"Add Python to PATH"&lt;/strong&gt; before clicking &lt;strong&gt;Install Now&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To verify your installation, open a terminal and type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Python is installed correctly, you'll see the installed version number.&lt;/p&gt;




&lt;h1&gt;
  
  
  Writing Your First Program
&lt;/h1&gt;

&lt;p&gt;Let's start with the classic program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, World!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;p&gt;Congratulations! You've written your first Python program.&lt;/p&gt;




&lt;h1&gt;
  
  
  Variables
&lt;/h1&gt;

&lt;p&gt;Variables store information that your program can use later.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.68&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can display them using &lt;code&gt;print()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Common Data Types
&lt;/h1&gt;

&lt;p&gt;Python has several built-in data types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;      &lt;span class="c1"&gt;# String
&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;            &lt;span class="c1"&gt;# Integer
&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.68&lt;/span&gt;       &lt;span class="c1"&gt;# Float
&lt;/span&gt;&lt;span class="n"&gt;is_student&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;   &lt;span class="c1"&gt;# Boolean
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding data types helps you write reliable programs and avoid common mistakes.&lt;/p&gt;




&lt;h1&gt;
  
  
  Getting User Input
&lt;/h1&gt;

&lt;p&gt;Programs become more useful when they interact with users.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter your name: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Enter your name: Victor
Hello, Victor
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Basic Operators
&lt;/h1&gt;

&lt;p&gt;Python supports arithmetic operators.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also calculate remainders using &lt;code&gt;%&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  Writing Comments
&lt;/h1&gt;

&lt;p&gt;Comments explain your code and are ignored by Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This is a comment
&lt;/span&gt;
&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Comments make your code easier for you and others to understand.
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;By completing this article, you've learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Python&lt;/li&gt;
&lt;li&gt;Write your first program&lt;/li&gt;
&lt;li&gt;Create variables&lt;/li&gt;
&lt;li&gt;Work with common data types&lt;/li&gt;
&lt;li&gt;Accept user input&lt;/li&gt;
&lt;li&gt;Perform basic calculations&lt;/li&gt;
&lt;li&gt;Write comments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the building blocks you'll use in almost every Python program.&lt;/p&gt;




&lt;h1&gt;
  
  
  What's Next?
&lt;/h1&gt;

&lt;p&gt;In &lt;strong&gt;Part 2&lt;/strong&gt;, we'll make our programs smarter by learning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comparison operators&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;if&lt;/code&gt;, &lt;code&gt;elif&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; loops&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Dictionaries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy coding, and see you in Part 2!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/victak36lgtm/python-for-beginners-part-2-mastering-python-fundamentals-4i6n"&gt;https://dev.to/victak36lgtm/python-for-beginners-part-2-mastering-python-fundamentals-4i6n&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Importance of Hypothesis Testing in Data Science</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Mon, 27 Jul 2026 05:47:03 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/importance-of-hypothesis-testing-in-data-science-2ppn</link>
      <guid>https://dev.to/victak36lgtm/importance-of-hypothesis-testing-in-data-science-2ppn</guid>
      <description>&lt;p&gt;A hypothesis is a clear, testable statement about a population or process. Hypothesis testing then uses sample data to decide whether there is enough evidence to support or reject that statement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hypothesis Testing: The Statistical Compass of Data Science&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Collecting data and training models are only part of the story. The real power of data science emerges when numbers are turned into decisions that can be trusted. Hypothesis testing is the method that makes those decisions rigorous rather than guesswork.&lt;/p&gt;

&lt;p&gt;It gives analysts a structured way to ask: “Is the pattern I see strong enough that random chance is an unlikely explanation?” Whether the question involves customer behavior, medical outcomes, marketing results, or operational improvements, the same disciplined process applies. Without it, conclusions rest on visual impressions or gut feeling. With it, they rest on quantified evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining the Framework
&lt;/h3&gt;

&lt;p&gt;Hypothesis testing evaluates whether sample evidence supports a claim about a larger population. It begins with two carefully worded statements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;null hypothesis (H₀)&lt;/strong&gt; represents the status quo—no difference, no effect, no relationship.
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;alternative hypothesis (H₁)&lt;/strong&gt; expresses the claim the analyst wants to investigate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A p-value measures how surprising the observed data would be if the null were true. When that probability falls below a chosen threshold (usually 0.05), the null is rejected. When it does not, the analyst simply fails to reject the null—an important distinction from “proving” it true.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practical Value for Data Teams
&lt;/h3&gt;

&lt;p&gt;The method delivers several concrete benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It separates genuine signals from noise.
&lt;/li&gt;
&lt;li&gt;It supplies a shared language of uncertainty for stakeholders.
&lt;/li&gt;
&lt;li&gt;It allows fair comparison of algorithms, treatments, or customer groups.
&lt;/li&gt;
&lt;li&gt;It turns vague observations (“sales seem higher”) into precise statements backed by probability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, it elevates analysis from description to inference.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Clear Workflow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Translate the business question into explicit null and alternative hypotheses.
&lt;/li&gt;
&lt;li&gt;Select the significance level and the test that matches the data structure and assumptions.
&lt;/li&gt;
&lt;li&gt;Calculate the test statistic and p-value.
&lt;/li&gt;
&lt;li&gt;Interpret the result in context, ideally reporting effect size and confidence intervals alongside the p-value.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Main Families of Tests
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;t-Tests&lt;/strong&gt; remain the most frequently used tools for continuous outcomes.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One-sample versions check a sample mean against a known benchmark.
&lt;/li&gt;
&lt;li&gt;Independent two-sample versions compare two separate groups (classic A/B tests).
&lt;/li&gt;
&lt;li&gt;Paired versions examine the same units before and after a change.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When data are roughly normal and groups are independent, these tests are efficient and easy to communicate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Z-tests&lt;/strong&gt; serve a narrower role—large samples with known population variance—yet still appear in large-scale proportion testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chi-square procedures&lt;/strong&gt; handle categorical variables. The test of independence asks whether two factors are associated; the goodness-of-fit test checks whether observed frequencies match expected proportions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ANOVA&lt;/strong&gt; extends the comparison of means to three or more groups. One-way ANOVA is the standard starting point; two-way versions add a second factor. When normality or equal-variance assumptions fail, the Kruskal-Wallis rank test provides a robust alternative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-parametric rank tests&lt;/strong&gt; fill the gaps left by parametric methods:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mann-Whitney U for two independent groups with skewed or ordinal data,
&lt;/li&gt;
&lt;li&gt;Wilcoxon signed-rank for paired non-normal differences,
&lt;/li&gt;
&lt;li&gt;Kruskal-Wallis for multiple groups under the same conditions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Selection Guide
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Preferred approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Single mean vs. fixed value&lt;/td&gt;
&lt;td&gt;One-sample t-test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two independent groups, normal data&lt;/td&gt;
&lt;td&gt;Independent or Welch t-test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two independent groups, non-normal data&lt;/td&gt;
&lt;td&gt;Mann-Whitney U&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Matched pairs, normal differences&lt;/td&gt;
&lt;td&gt;Paired t-test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Matched pairs, non-normal differences&lt;/td&gt;
&lt;td&gt;Wilcoxon signed-rank&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Three or more groups, normal data&lt;/td&gt;
&lt;td&gt;One-way ANOVA&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Three or more groups, non-normal data&lt;/td&gt;
&lt;td&gt;Kruskal-Wallis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Relationship between categories&lt;/td&gt;
&lt;td&gt;Chi-square independence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observed vs. theoretical frequencies&lt;/td&gt;
&lt;td&gt;Chi-square goodness-of-fit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Everyday Applications and Caveats
&lt;/h3&gt;

&lt;p&gt;In day-to-day work these tests support A/B experimentation, model comparison, feature screening, process monitoring, and quasi-experimental evaluation. They appear both in formal research and in rapid business experiments.&lt;/p&gt;

&lt;p&gt;Experienced practitioners treat p-values as only one piece of evidence. Practical importance (effect size), multiple-testing corrections, and assumption checks are equally essential. Large samples can make tiny differences statistically significant; domain knowledge must still decide whether those differences matter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Perspective
&lt;/h3&gt;

&lt;p&gt;Hypothesis testing is the quiet discipline that keeps data science accountable. It forces clear claims, quantifies uncertainty, and protects teams from mistaking noise for insight. When used thoughtfully—paired with effect sizes, diagnostics, and subject-matter judgment—it becomes one of the most reliable tools for turning data into decisions that stand up to scrutiny.&lt;/p&gt;

</description>
      <category>analysis</category>
      <category>data</category>
      <category>datascience</category>
      <category>science</category>
    </item>
    <item>
      <title>Understanding SQL: DDL, DML, and Data Transformation</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Fri, 24 Apr 2026 04:59:22 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/-understanding-sql-ddl-dml-and-data-transformation-3hkh</link>
      <guid>https://dev.to/victak36lgtm/-understanding-sql-ddl-dml-and-data-transformation-3hkh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Structured Query Language (SQL) is the standard language for managing and manipulating relational databases.&lt;/p&gt;

&lt;p&gt;This article explores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Definition Language (DDL)&lt;/li&gt;
&lt;li&gt;Data Manipulation Language (DML)&lt;/li&gt;
&lt;li&gt;Filtering with WHERE&lt;/li&gt;
&lt;li&gt;Conditional logic using CASE WHEN&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Are DDL and DML?
&lt;/h2&gt;

&lt;p&gt;SQL commands are broadly categorized into two groups: &lt;strong&gt;DDL&lt;/strong&gt; and &lt;strong&gt;DML&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Definition Language (DDL)
&lt;/h3&gt;

&lt;p&gt;DDL commands define and modify the &lt;strong&gt;structure&lt;/strong&gt; of database objects. They shape of your database—creating tables, altering columns, and removing schemas. DDL operations take effect immediately and permanently.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CREATE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Build new database objects (schemas, tables, columns)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ALTER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Modify existing structures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DROP&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete objects entirely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RENAME&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Change object names&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Data Manipulation Language (DML)
&lt;/h3&gt;

&lt;p&gt;DML commands manage the &lt;strong&gt;data inside&lt;/strong&gt; tables, adding rows, updating values, and deleting records. Unlike DDL, DML changes can be rolled back using transactions if something goes wrong.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;INSERT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add new rows to a table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;UPDATE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Modify existing data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DELETE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove specific rows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SELECT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Retrieve data (sometimes classified as DQL)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Key Difference
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;DDL&lt;/th&gt;
&lt;th&gt;DML&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Focus&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Structure&lt;/td&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Commands&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;CREATE&lt;/code&gt;, &lt;code&gt;ALTER&lt;/code&gt;, &lt;code&gt;DROP&lt;/code&gt;, &lt;code&gt;RENAME&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;, &lt;code&gt;SELECT&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reversibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Permanent (auto-commit)&lt;/td&gt;
&lt;td&gt;Can be rolled back&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Adding a new column&lt;/td&gt;
&lt;td&gt;Changing a student's grade&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  DDL in Action: Building the Nairobi Academy Database
&lt;/h2&gt;

&lt;p&gt;In the Nairobi Academy assignment, DDL commands established the entire database framework from scratch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the Schema and Tables
&lt;/h3&gt;

&lt;p&gt;The first step was creating a dedicated schema to organize all school-related tables:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sql
CREATE SCHEMA nairobi_academy;
SET search_path TO nairobi_academy;
Then three tables were built using CREATE TABLE:
sql
-- Students table stores pupil information
CREATE TABLE students (
    student_id SERIAL PRIMARY KEY,
    first_name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50) NOT NULL,
    gender CHAR(1) CHECK (gender IN ('M', 'F')),
    class VARCHAR(20),
    city VARCHAR(50),
    date_of_birth DATE
);

-- Subjects table stores courses offered
CREATE TABLE subjects (
    subject_id SERIAL PRIMARY KEY,
    subject_name VARCHAR(100) NOT NULL,
    department VARCHAR(50),
    credits INTEGER
);

-- Exam_results links students to their scores
CREATE TABLE exam_results (
    result_id SERIAL PRIMARY KEY,
    student_id INTEGER REFERENCES students(student_id),
    subject_id INTEGER REFERENCES subjects(subject_id),
    marks INTEGER CHECK (marks &amp;gt;= 0 AND marks &amp;lt;= 100),
    exam_date DATE
);
Modifying Structure with ALTER
Real-world databases evolve. When the school forgot to include phone numbers, ALTER TABLE resolved it:
sql
Copy
ALTER TABLE students ADD COLUMN phone_number VARCHAR(20);
Later, the credits column needed clearer naming:
sql

ALTER TABLE subjects RENAME COLUMN credits TO credit_hours;
When the requirement changed again, the column was removed:
sql

ALTER TABLE students DROP COLUMN phone_number;
These ALTER operations demonstrate DDL's flexibility—structures adapt without rebuilding everything.
DML in Action: Populating and Managing Data
Once tables existed, DML commands brought them to life with real student records.
INSERT: Adding Data
Ten students, ten subjects, and ten exam results were inserted:
sql

INSERT INTO students (first_name, last_name, gender, class, city, date_of_birth) 
VALUES ('James', 'Mwangi', 'M', 'Form 4', 'Nairobi', '2006-03-15');
The INSERT statement follows a clear pattern: specify the table, list columns, then provide values in matching order. Bulk inserts use comma-separated value sets.
UPDATE: Correcting Data
When Esther Akinyi moved from Nakuru to Nairobi, UPDATE reflected this change:

sql
UPDATE students 
SET city = 'Nairobi' 
WHERE student_id = 5;
A marks entry error was also fixed:

sql

UPDATE exam_results 
SET marks = 59 
WHERE result_id = 5;
Critical rule: Always use WHERE with UPDATE. Without it, every row changes.
DELETE: Removing Data
When an exam was cancelled, DELETE removed it cleanly:
sql

DELETE FROM exam_results 
WHERE result_id = 9;
Again, WHERE is essential—omitting it empties the entire table.
Filtering Data with WHERE
The WHERE clause is SQL's gatekeeper. It filters rows based on conditions, ensuring queries return only relevant data.
Basic Comparison Operators
Table
Operator    Meaning Example
=   Equal to    WHERE class = 'Form 4'
&amp;gt;   Greater than    WHERE marks &amp;gt; 70
&amp;lt;   Less than   WHERE marks &amp;lt; 40
&amp;gt;=  Greater than or equal   WHERE marks &amp;gt;= 70
&amp;lt;=  Less than or equal  WHERE marks &amp;lt;= 50
&amp;lt;&amp;gt; or !=    Not equal   WHERE city &amp;lt;&amp;gt; 'Nairobi'
Logical Operators
Combine conditions with AND and OR:

sql
-- Form 3 students from Nairobi (both conditions must be true)
SELECT * FROM students WHERE class = 'Form 3' AND city = 'Nairobi';

-- Students in Form 2 or Form 4 (either condition can be true)
SELECT * FROM students WHERE class = 'Form 2' OR class = 'Form 4';
Special Operators
BETWEEN checks ranges inclusively:

sql
-- Marks from 50 to 80, including both endpoints
SELECT * FROM exam_results WHERE marks BETWEEN 50 AND 80;
IN checks membership in a list:

sql

-- Students in any of these three cities
SELECT * FROM students WHERE city IN ('Nairobi', 'Mombasa', 'Kisumu');
N IN excludes values:

sql

-- Students in Form 1 or Form 4 only
SELECT * FROM students WHERE class NOT IN ('Form 2', 'Form 3');

LIKE enables pattern matching with wildcards:
Table
Pattern Matches
'A%'    Starts with 'A'
'%Studies%' Contains 'Studies' anywhere
'_a%'   Second letter is 'a'

sql

-- First names starting with A or E
SELECT * FROM students 
WHERE first_name LIKE 'A%' OR first_name LIKE 'E%';
Transforming Data with CASE WHEN
Raw data often needs interpretation before it becomes useful. CASE WHEN acts as SQL's if-then-else logic, creating new calculated columns based on conditions.
Grading Exam Results
Instead of displaying raw marks, the assignment labeled each score with a performance grade:
sql

SELECT 
    result_id,
    marks,
    CASE 
        WHEN marks &amp;gt;= 80 THEN 'Distinction'
        WHEN marks &amp;gt;= 60 THEN 'Merit'
        WHEN marks &amp;gt;= 40 THEN 'Pass'
        ELSE 'Fail'
    END AS performance
FROM exam_results;
SQL evaluates conditions top to bottom. A mark of 85 hits the first condition (&amp;gt;= 80) and becomes "Distinction"—it never reaches the &amp;gt;= 60 check. This ordering is crucial.
Categorizing Students
Students were grouped into academic levels:
sql

SELECT 
    first_name,
    last_name,
    class,
    CASE 
        WHEN class IN ('Form 3', 'Form 4') THEN 'Senior'
        WHEN class IN ('Form 1', 'Form 2') THEN 'Junior'
    END AS student level
FROM students;
Every CASE must end with END, and AS names the new column.    

Inconclusion, DDL builds the container, while DML fills and shapes the content. The Nairobi Academy data, demonstrated this relationship—CREATE and ALTER established tables, then INSERT, UPDATE, and DELETE managed student records. Filtering with WHERE and operators like BETWEEN, IN, and LIKE narrowed results to specific needs. Finally, CASE WHEN transformed numerical marks into meaningful categories, proving that SQL is not just about storing data—it's about making data understandable.
Mastering these basics prepares you for;
*joins
*windows functions
*Query optimization
*subqueries.
 In SQL real understanding comes from writing queries and lots of practice.


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Unlocking Insights: Transforming Messy Data Into Action Using Power BI</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Mon, 09 Feb 2026 06:37:03 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/unlocking-insights-transforming-messy-data-into-action-using-power-bi-3lnn</link>
      <guid>https://dev.to/victak36lgtm/unlocking-insights-transforming-messy-data-into-action-using-power-bi-3lnn</guid>
      <description>&lt;ol&gt;
&lt;li&gt;
## How Analysts Clean Messy Data, Use DAX, and Build Dashboards Using Power BI
Power BI is an intelligent tool that helps organizations visualize and analyze their data. Raw day-to-day data can be messy and unfiltered. Analysts often deal with missing values, inconsistent formats, duplicates, and poorly structured tables. Power BI stands out because it allows analysts to clean, model, analyze, and visualize data. This article explains how analysts transform messy data into meaningful insights.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Cleaning Messy Data with Power Query
&lt;/h2&gt;

&lt;p&gt;After loading your dataset, open &lt;em&gt;transform data&lt;/em&gt; to access the Power Query Editor.&lt;/p&gt;

&lt;h3&gt;
  
  
  common data problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Duplicate records- Inconsistent text (e.g.  'cardiology' 'cardio dep' 'Cardiolgy')
&lt;/li&gt;
&lt;li&gt;Numbers stored as text
&lt;/li&gt;
&lt;li&gt;Multiple values in a single column
&lt;/li&gt;
&lt;li&gt;Inconsistent date form&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some of the common Power query Transformation are:&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Data Problems
&lt;/h2&gt;

&lt;p&gt;Real-world datasets are rarely perfect. Analysts often encounter the following data issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing values (nulls or blanks)&lt;/li&gt;
&lt;li&gt;Duplicate records&lt;/li&gt;
&lt;li&gt;Inconsistent text values (cardiology, Cardiology, Cardiology dept)&lt;/li&gt;
&lt;li&gt;Incorrect data types (numbers stored as text)&lt;/li&gt;
&lt;li&gt;Inconsistent date formats&lt;/li&gt;
&lt;li&gt;Spelling errors and typos&lt;/li&gt;
&lt;li&gt;Extra spaces or hidden characters&lt;/li&gt;
&lt;li&gt;Multiple values stored in a single column&lt;/li&gt;
&lt;li&gt;Inconsistent units of measurement&lt;/li&gt;
&lt;li&gt;Outliers and extreme values&lt;/li&gt;
&lt;li&gt;Poorly structured tables&lt;/li&gt;
&lt;li&gt;Mismatched keys between tables&lt;/li&gt;
&lt;li&gt;Changing data definitions over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Addressing these problems during data preparation ensures accurate analysis, reliable dashboards, and trustworthy business insights.&lt;/p&gt;

&lt;p&gt;Power Query automatically records every step, so you can modify your transformation at any time.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Understanding Data Modelling in Power BI
&lt;/h2&gt;

&lt;p&gt;Before you start writing DAX, it’s important to understand data modelling. A data model is simply the way your tables connect inside Power BI. Think of it as the “map” that tells Power BI how your data fits together.&lt;/p&gt;

&lt;p&gt;A good data model usually includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fact tables&lt;/strong&gt; – contain numbers you want to analyze (sales, revenue, quantities).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dimension tables&lt;/strong&gt; – contain descriptive information (dates, products, customers).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relationships&lt;/strong&gt; – links between tables that allow Power BI to filter and calculate correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A clean model makes your reports faster, your calculations easier, and your DAX formulas more accurate.&lt;/p&gt;

&lt;p&gt;Once your data model is organized, you can start adding DAX logic to create measures, calculations, and business rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Data Analysis Expressions(&lt;em&gt;DAX)&lt;/em&gt; To create Business Logic
&lt;/h2&gt;

&lt;p&gt;With a clean data we use &lt;em&gt;dax&lt;/em&gt; to create calculations questions. &lt;br&gt;
Dax is used for:&lt;br&gt;
-conditional logic &lt;br&gt;
-time intelligence&lt;br&gt;
-Measures ratios and percentages&lt;/p&gt;

&lt;p&gt;Examples of &lt;strong&gt;Dax&lt;/strong&gt; measure&lt;br&gt;
Total Sales =&lt;br&gt;
SUM(Fact Sales[Sales Amount])&lt;/p&gt;

&lt;p&gt;Sales Growth =&lt;br&gt;
DIVIDE([Total Sales] - [Last Year Sales], [Last Year Sales])&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Simple and Clean Dashboards
&lt;/h2&gt;

&lt;p&gt;An effective dashboard presents only the most important metrics, allowing users to understand insights at a glance without being overwhelmed by unnecessary visuals. By prioritizing key KPIs, using consistent layouts analysts create dashboards that are intuitive, easy to navigate, and focused on actionable insights. &lt;/p&gt;

&lt;p&gt;Common Power BI visuals are like;&lt;/p&gt;

&lt;p&gt;-Bar graphs and column chats&lt;/p&gt;

&lt;p&gt;-Line charts for trends&lt;/p&gt;

&lt;p&gt;-KPI cards&lt;/p&gt;

&lt;p&gt;-Tables and matrices for detail&lt;/p&gt;

&lt;p&gt;-Maps for geographic analysis&lt;/p&gt;

&lt;p&gt;Using Power Query to clean and &lt;strong&gt;Dax&lt;/strong&gt;, adding logic to data you can transform raw data into meaningful insights.&lt;/p&gt;

&lt;p&gt;Inconclusion cleaning and preparing data is the basic foundation of every Insightful &lt;strong&gt;Power BI&lt;/strong&gt; . When you build a clear data model and choose the rightful visuals, your dashboards become intuitive data or report. &lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>tutorial</category>
      <category>begginer</category>
    </item>
    <item>
      <title>#Schemas and Data Modelling in Power BI</title>
      <dc:creator>Victor Karanja</dc:creator>
      <pubDate>Sun, 01 Feb 2026 22:01:17 +0000</pubDate>
      <link>https://dev.to/victak36lgtm/schemas-and-data-modelling-in-power-bi-1ad9</link>
      <guid>https://dev.to/victak36lgtm/schemas-and-data-modelling-in-power-bi-1ad9</guid>
      <description>&lt;h2&gt;
  
  
  Schemas and Data Modelling in Power BI
&lt;/h2&gt;

&lt;p&gt;Data modelling is one of the most important steps in Power BI. A well-designed data model improves performance, accuracy, and ease to analyse, while a poor model can lead to slow reports and incorrect insights.&lt;/p&gt;

&lt;p&gt;This article explains schemas and data modelling concepts in Power BI.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is Data Modelling?
&lt;/h2&gt;

&lt;p&gt;Data Modelling involves organizing data sources into a structured model. In Power BI, this means organizing tables and defining relationships between them to support accurate reporting and efficient calculations.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Schema?
&lt;/h2&gt;

&lt;p&gt;A schema is the structure and organization of data in a table. It's the logical arrangement of tables used in reports on Power BI.&lt;/p&gt;

&lt;p&gt;In Power BI, schemas help determine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How data is connected&lt;/li&gt;
&lt;li&gt;How filters flow between tables&lt;/li&gt;
&lt;li&gt;How efficiently queries are executed. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;****Types of schemas in Power BI.&lt;/p&gt;

&lt;p&gt;-Galaxy schema&lt;br&gt;
-Snowflakes schema&lt;br&gt;
-star schema&lt;/p&gt;

&lt;h2&gt;
  
  
  Snowflakes schema
&lt;/h2&gt;

&lt;p&gt;Here dimensions are split into sub dimensions, that can also be split into further smaller tables. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzf3acrco6ua0tqlb8j33.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzf3acrco6ua0tqlb8j33.jpg" alt="_snowflake diagram_" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;Star schema&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;It's the mostly schema used in Excel, where it has multiple dimensions and one fact table.&lt;br&gt;
its advantages are; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster query performance&lt;/li&gt;
&lt;li&gt;Easier to write DAX formulas&lt;/li&gt;
&lt;li&gt;Better filter
-Easy to understand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hcmxfxrx8y4hbcc9bll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hcmxfxrx8y4hbcc9bll.png" alt="_star schema image_" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fact Tables
&lt;/h2&gt;

&lt;p&gt;A fact table stores quantitative data (measures) that can be analysed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Characteristics of Fact Tables:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Contain numerical values&lt;/li&gt;
&lt;li&gt;Have many rows&lt;/li&gt;
&lt;li&gt;Reference dimension tables using keys&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Examples:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Costomer Id&lt;/li&gt;
&lt;li&gt;Name&lt;/li&gt;
&lt;li&gt;Age&lt;/li&gt;
&lt;li&gt;Region&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Dimension Tables
&lt;/h2&gt;

&lt;p&gt;A dimension table contains descriptive information that provides context to facts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Characteristics of Dimension Tables:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Contain text or categorical data&lt;/li&gt;
&lt;li&gt;Have fewer rows than fact tables&lt;/li&gt;
&lt;li&gt;Used for filtering and grouping data&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Examples:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Date&lt;/li&gt;
&lt;li&gt;Product&lt;/li&gt;
&lt;li&gt;Customer ID&lt;/li&gt;
&lt;li&gt;Location&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Is a Relationship in Power BI?
&lt;/h2&gt;

&lt;p&gt;A relationship connects a column in one table to a column in another table, usually through a key.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Sales[ProductID] → Product[ProductID]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows Power BI to understand how records relate across tables.&lt;/p&gt;




&lt;h2&gt;
  
  
  Relationship Types in Power BI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  One-to-Many
&lt;/h3&gt;

&lt;p&gt;This is the most common and recommended relationship type.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One record in a dimension table&lt;/li&gt;
&lt;li&gt;Many matching records in a fact table&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;One product → many sales records&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Used in star schemas.&lt;/p&gt;




&lt;h3&gt;
  
  
  Many-to-Many (&lt;em&gt;:&lt;/em&gt;)
&lt;/h3&gt;

&lt;p&gt;Occurs when both tables contain duplicate values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can cause ambiguous results&lt;/li&gt;
&lt;li&gt;Should be avoided when possible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use only when necessary and with caution.&lt;/p&gt;




&lt;h3&gt;
  
  
  One-to-One (1:1)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each value appears once in both tables&lt;/li&gt;
&lt;li&gt;Rarely used in analytical models&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Relationship Direction
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Single Direction (Recommended)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Filters flow from dimension tables to fact tables&lt;/li&gt;
&lt;li&gt;Predictable and efficient behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Best practice for star schemas.&lt;/p&gt;




&lt;h3&gt;
  
  
  Both Direction (Bi-Directional)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Filters flow both ways&lt;/li&gt;
&lt;li&gt;Can cause confusion and performance issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use only when absolutely necessary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Relationships in Star Schema
&lt;/h2&gt;

&lt;p&gt;In a star schema:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All dimension tables connect directly to the fact table&lt;/li&gt;
&lt;li&gt;Relationships are one-to-many&lt;/li&gt;
&lt;li&gt;Filter direction is single&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This results in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster performance&lt;/li&gt;
&lt;li&gt;Simpler DAX formulas&lt;/li&gt;
&lt;li&gt;Accurate filtering&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Relationships in Snowflake Schema
&lt;/h2&gt;

&lt;p&gt;In a snowflake schema:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dimension tables connect to other dimension tables&lt;/li&gt;
&lt;li&gt;More relationships are required&lt;/li&gt;
&lt;li&gt;More joins occur during queries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce performance in Power BI&lt;/li&gt;
&lt;li&gt;Complicate filter behavior&lt;/li&gt;
&lt;li&gt;Make DAX harder to write and maintain&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Relationships Matter in Power BI
&lt;/h2&gt;

&lt;p&gt;Correct relationships:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure accurate calculations&lt;/li&gt;
&lt;li&gt;Control how filters behave&lt;/li&gt;
&lt;li&gt;Improve report performance&lt;/li&gt;
&lt;li&gt;Prevent incorrect totals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Poor relationships can lead to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incorrect results&lt;/li&gt;
&lt;li&gt;Slow visuals&lt;/li&gt;
&lt;li&gt;Broken slicers and filters&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Best Practices for Power BI Relationships
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use star schema whenever possible&lt;/li&gt;
&lt;li&gt;Keep relationships one-to-many&lt;/li&gt;
&lt;li&gt;Use single-direction filtering&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Avoid many-to-many relationships
&lt;/h2&gt;

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

&lt;p&gt;Good data modelling is the foundation of effective Power BI reporting. By using well-structured schemas such as the star and snowflake schema and defining correct relationships, you can improve performance, ensure accurate calculations, and create reports that are easy to understand and maintain. Investing time in proper modelling leads to faster insights and more reliable decision-making.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
