My Python Learning Log: Expressions, Operators & Decision Making

kasumbi philkasumbi phil
2 min read

Today’s Python session was super productive! I dived deeper into how Python handles logic and conditions, and even wrapped things up with a mini-project: a Movie Ticket Checker

Here’s what I covered:


✅ Expressions & Operations in Python

I started with the basics of expressions and operators—the core of how Python performs calculations and logic.

🔹 Arithmetic Operators

These are the classic ones like:

  • + (Addition)

  • - (Subtraction)

  • * (Multiplication)

  • / (Division)

  • // (Floor Division)

  • % (Modulus)

  • ** (Exponentiation)

🔹 Comparison Operators

Used to compare values:

  • == (Equal to)

  • != (Not equal to)

  • > (Greater than)

  • < (Less than)

  • >=, <=

🔹 Logical Operators

Perfect for combining multiple conditions:

  • and

  • or

  • not

🔹 Assignment & Reassignment

I also practiced assigning values to variables and updating them:

x = 5
x = x + 1  # Now x is 6

Decision Making in Python

This part was super interesting because it taught me how to control the flow of my program.

🔸 if, elif, else

Python’s way of letting your code make decisions.

🔸 Nested Conditions

You can put one condition inside another—great for when checks depend on previous logic.

🔸 match-case (Python 3.10+)

Like a switch statement, but more powerful. A new feature I’ll definitely explore more!


🎬 Mini Project: Movie Ticket Checker

To apply what I learned, I built a basic script that decides if someone can book a movie ticket based on age, student ID, and the current time.

Here’s the code:

age = int(input("Enter your age: "))
studentId = input("Do you have student ID (yes/no)? ").lower()
movieTime = int(input("What is the time? (24hrs format): "))

if age >= 18:
    print("Can book the Ticket")
elif age < 18:
    if studentId == "yes" and movieTime < 1800:
        print("You can book the Ticket")
    else:
        print("Time is up for kids")
else:
    print("You are not allowed to book the Ticket")

💬 Final Thoughts

Today’s lesson really helped me understand how programs think and decide. The mix of logic, variables, and flow control opened my eyes to what’s possible with even basic Python knowledge.

I’m excited to keep building more projects and keep the momentum going

0
Subscribe to my newsletter

Read articles from kasumbi phil directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

kasumbi phil
kasumbi phil