Beginner’s Guide to Programming Concepts on Python

Developers Tutorials
2 min readDec 7, 2023
Photo by Chris Ried on Unsplash

Welcome to the world of programming!

If you’re just starting out, this guide is designed to introduce you to some fundamental concepts that form the backbone of most programming languages.

We’ll explore variables, loops, and conditionals, breaking them down with simple explanations and examples. Let’s dive in!

Understanding Variables

In programming, a variable is like a storage box where you can keep data.

Think of it as a labeled container for storing information that your program can use.

Here’s what you need to know about variables:

  • Declaration: This is when you create a variable and give it a name.
  • Assignment: This involves setting a value to your variable.
  • Data Types: Variables can store different types of data, such as numbers (integers and floats), text (strings), or even Boolean values (true/false).

Example in Python:

myNumber = 5 # An integer variable
myString = "Hello!" # A string variable

Loops: Doing Things Over and Over

Loops are used in programming when you need to repeat a set of instructions multiple times. There are mainly two types of loops:

  • For Loops: Used when you know in advance how many times you need to repeat the actions.
  • While Loops: Used when you want to continue looping as long as a certain condition is true.

For Loop Example in Python:

for i in range(5):
print("I'm learning to code!")

While Loop Example in Python:

count = 0
while count < 5:
print("I'm practicing loops!")
count += 1

Conditionals: Making Decisions

Conditionals are like crossroads in your code. They allow your program to make decisions based on certain conditions. The most common conditional statement is `if`.

  • If Statements: Execute a block of code if a particular condition is true.
  • Else and Elif: Used…