Building a Simple Hospital Queue Checker

Python for Beginners: Build Practical Software Skills with Hospital-Themed Projects
Lesson Content
0% Complete

By the end of this chapter you will be able to:

  • Use if, elif, and else to control program flow.
  • Write simple conditions using comparison operators.
  • Explain why programs need decision-making logic.
  • Build a basic rule-based check-in or alert system.
  • Test different inputs to see how branches change.

Key topics: Why programs need decisions, Comparison operators, if, elif, and else, Boolean logic basics, Testing branches with sample values

Suggested time this week: 2 hours video/demo, 1.5 hours guided practice, 1 hour exercise, 1 hour lab, 0.5 hour quiz and review


A practical beginner often wants to know, “How do I make my program respond differently depending on the situation?” The answer is to write clear conditions and test them carefully. This lesson shows how to build a small queue checker using fictional hospital data.

Imagine a front-desk team wants a quick script that labels the current waiting queue. If the queue is short, the staff can continue normally. If it is long, they may need to alert another team member. This is a realistic software engineering use case because it turns numbers into action.

The program begins by asking for the current queue size or by using a sample value while learning. Then it compares that number with thresholds. The programmer decides what counts as low, medium, or high. This step matters because code should reflect a business rule, not just random numbers. For beginners, the rule can be simple and documented in a comment.

Once the rule is set, the if statement checks the condition. If queue size is greater than 15, the program prints a high-volume warning. If it is between 6 and 15, it prints a moderate message. Otherwise, it prints a low-volume message. The learner should notice that the program has one input, but several possible outputs.

Testing is essential. A beginner should try different sample numbers and confirm that each one lands in the right branch. This teaches careful thinking and reduces guesswork. If the output is wrong, the learner should inspect the comparison signs, the order of the conditions, and the indentation.

This chapter also helps learners understand that code is often about rule translation. In a hospital system, rules may reflect workload, availability, or urgency. Python helps express those rules in a way a computer can follow consistently.

By the end of this lesson, the learner should be able to write a simple decision-based program and explain why one branch runs instead of another. That is a key milestone in programming confidence.