Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
PYTHON FOUNDATIONS / CHAPTER 01 / Learn / LESSON 01
Welcome to the first Code Lab class. Today we are not writing “hello world” for its own sake — we are booting a small system that will grow with you: Health Engine.
In programming, almost everything starts with names. A variable is a labeled box: you put a value in it and later use it by name. In Python, text (a string) goes in quotes — "Health Engine". Numbers are written without quotes — 1.0. If you put quotes around 1.0, it is no longer a number but text, and later calculations will break.
Assignment is simple: name = value. The line system = "Health Engine" means: “store this text under the name system”. The line version = 1.0 does the same for a number.
Once a value is in a variable, we want to see it. The print() function writes to the console. print(system) does not print the word system — it prints the contents of the box. That difference between name and value is something you will use constantly.
Mini example (not the full solution):
name = "Lab"
print(name)Common mistake: version = "1.0" instead of version = 1.0. The text looks “like a number”, but for Python it is a string.
A variable stores a value. Put text inside quotes; write numbers without quotes. print() displays a value in the console.
TERMINAL WAITING
›