Content · Programming · Python

Python Beginner Practice: Store and Display Product Information

Displaying product information is a useful beginner exercise for combining strings, integers, decimal values, and Boolean flags. Learn the essential ideas and try a practical example.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

Displaying product information is a useful beginner exercise for combining strings, integers, decimal values, and Boolean flags.

Understanding the Concept


Create one variable for each characteristic of a product: name, quantity, unit price, and availability. Use print() to produce a readable summary. The field names explain the values without requiring a dictionary or database. Later lessons will combine related values into collection types or objects for larger applications.

When and Why You Would Use This


Pay attention to text labels and units. A number printed without a label can be difficult to understand, while a clear summary can be read by someone who never saw your source code.

Practical Example


product_name = "Wireless Mouse"
stock_quantity = 8
unit_price = 19.95
is_available = stock_quantity > 0
print("Product:", product_name)
print("In stock:", stock_quantity)
print("Price:", unit_price)
print("Available:", is_available)

Understanding the Example


The script displays four lines. Because stock_quantity is greater than zero, is_available is True. The example is a static snapshot; it does not update real inventory or save records after execution.

Example Output


Product: Wireless Mouse
In stock: 8
Price: 19.95
Available: True

Try It Yourself


Add a product_category and a discount percentage. Print a clear five-line product summary.

Common Beginner Mistakes


  • Confusing the stock count with the availability Boolean.
  • Displaying monetary values without currency units in a customer-facing application.
  • Assuming a variable-based example is already a persistent database system.

Key Takeaways


  • Use types appropriate to each product field.
  • Clear output labels make printed results understandable.
  • Simple variables form a foundation for later structured data models.
Share this resourceSend this page to someone who may find it useful.