-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_variables.py
More file actions
42 lines (30 loc) · 1.08 KB
/
01_variables.py
File metadata and controls
42 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
01_variables — short examples of variables and basic operations.
This small example demonstrates variable assignment, simple types
(string, integer, boolean), printing, and updating a value.
"""
from __future__ import annotations
def display_profile(name: str, age: int, height_cm: int, is_lifting_today: bool):
"""
Print a short human-friendly profile using f-strings.
Kept intentionally simple — this is an educational example showing
how variables are stored and used in formatted output.
"""
print(f"My name is {name}")
print(f"I am {age} years old.")
print(f"My height is {height_cm} cm.")
print(f"Lifting today: {is_lifting_today}")
def main() -> None:
# variable assignments (clear names and types)
name = "Gavin Barbee"
age = 24
height_cm = 180
is_lifting_today = True
# show the profile
display_profile(name, age, height_cm, is_lifting_today)
# update a variable (increment age) and show the change
# NOTE: `age += 1` is shorthand for `age = age + 1` and preferred style.
age += 1
print(f"Next year, I will be {age}")
if __name__ == "__main__":
main()