From Calculator to Code: Understanding How Programming Languages Work

Lesson Overview

Learn how everyday devices like calculators work behind the scenes and discover why Python is the perfect programming language to start your coding journey. This beginner-friendly introduction builds intuition before diving into technical concepts.

Lesson Content

🧮Have You Ever Wondered How Your Calculator Works?

Think about that CASIO calculator you use in your classes. When you press 2 + 3, something amazing happens:

  • Input: You provide numbers and operations like (2 + 3) or (10 -2)
  • Process: Calculator follows pre-defined mathematical rules
  • Output: Result appears on screen as (5) or (8)

But here's the interesting part - your calculator doesn't naturally "know" how to add or subtract. Someone had to program it with step-by-step instructions to perform these operations.

🏧ATM Machine

Similarly, when you use an ATM:

  • Input:  Insert your Card, Enter the PIN, Enter withdrawal amount
  • Process: Pre-defined banking operations will be performed (verify PIN, check balance, dispense cash from ATM and updates Balance )
  • Output: Gives Money and prints receipt

Again, someone programmed the ATM to behave exactly this way!

 It's not just ATMs or calculators - every digital device or system around us is pre-programmed with specific instructions to carry out its designated tasks and deliver the expected results.

Can you name one other device at your home or school that’s “programmed” to behave a certain way?

So, What Exactly is Programming?

Programming is simply giving step-by-step instructions to computers, just like giving directions to a friend:

"Take the second left, go straight for 500 meters, then turn right at the signal."

In programming, we write similar instructions for computers using special languages called Programming languages. There are many programming languages available around the world. where each language has its particular strengths and is crafted to work with designated systems, Below are few popular ones and its use case:

  • Java (used in Android apps)
  • JavaScript (makes websites interactive)
  • C++ (builds games and fast applications)
  • Python (perfect for beginners!)

Why Python is Perfect for You

Python is like the English language of programming - it's designed to be easy to understand and write the code. Rather than focusing on complex syntax, you can concentrate on building logic. This makes Python perfect for beginners to programming, while still providing extensive capabilities (we'll explore more of this later)

Python Works Just Like Your Calculator

Input in Python

similar to how a calculator waits for you to enter numbers, Python pauses and waits for your input, Python takes input from Users by using the input function.

name = input("What's your name? ")
age = input("What's your age? ")

You don't need to grasp every detail right now - just stay with the lesson and follow along

Don’t worry if you type something wrong or see an error! Everyone—especially beginners—learns best by trying things and making little mistakes

Output in Python

Similar to how a calculator displays results on its screen, Python can show messages to you. Let's have Python greet you with a Hello message - Python uses the print function to provide output on ths Screen.

print("Hello! I'm learning Python and it's awesome! ")

When you run this, Python will display:

Hello! I'm learning Python and it's awesome! 

Congratulations! You've just successfully understood and written your first program in Python by instructing it to show a message

How to Run Python Code

To run Python, you need an interpreter (think of it as a translator between you and computer):

Option 1: Google Colab (Recommended for Beginners)

  • Go to colab.research.google.com
  • Sign in with Google account
  • Click "New Notebook"
  • Start typing Python code immediately in the Cells

Option 2: Install on Your Computer

  • Visit python.org
  • Download Python (latest version)
  • Install like any other software
  • Open IDLE or use VS Code

Quick Challenge

Try running these commands and see what happens:

print("My name is <your_name>")
print("I am excited to learn Python!")
print(2 + 3)
print(10 * 5)

Notice how Python can handle both text and mathematics!

Quick Recap:

  • How day to day Digital Systems uses programming?
  • What is Programming?
  • Why is Python is perfect for beginners to Programming.
  • Understanding how python takes input and shows output( input function and print function)
  • How to run Python Code locally or online
ByLearning Agenda:

At ByLearning, we don't aim to overwhelm you with every programming detail. Our focus is on showing students the practical value of Python through meaningful, real-world examples, while making learning as intuitive as possible. We've intentionally designed this course differently from conventional approaches, prioritizing clarity and ease of understanding.

What's Coming Next?

In our next lesson, we'll learn about Python's "memory boxes" called variables - imagine being able to store your favourite things (names, numbers, messages) and use them whenever you want!