Overview
Project details
A simple project to practice variable assignments in Python.
Specifications
Objective:
Create a Python script that demonstrates the use of variable assignments with different data types.
Context:
The project should include examples of assigning values to variables, reassigning variables, and using variables in expressions.
Tracks: Python
70
number of points you will earn
2
launches to complete the project
4
tasks to complete the project
This project is part of the following tracks:
Learning outcomes
Understanding variable assignment, data types, and basic expressions in Python.
Project Launches & Tasks
launch_1
-
task_1 (10 points)
- Create a Python script named
variables_example.py
in thesrc/pytemplate/utils/
folder. - In this script, assign an integer value to a variable named
my_int
. - Assign a string value to a variable named
my_str
. - Assign a float value to a variable named
my_float
. - Add or update unit tests for these assignments in
tests/test_utils.py
. - Use type hints for any functions if created.
- Do not forget to implement unit tests for variable assignments
- Create a Python script named
-
task_2 (15 points)
- In the same
src/pytemplate/utils/variables_example.py
add a functionprint_variables()
that prints all three variables. - Use type hints for the function.
- Add or update pytest tests for the reassignment and the function in
tests/test_utils.py
. - Do not forget to implement pytest tests for variable reassignment and print function
- In the same
launch_2
-
task_3 (20 points)
- Create a Python script named
expressions_example.py
in thesrc/pytemplate/utils/
folder. - Assign integer variables
a
andb
with values. - Create a new variable
sum_ab
that stores the sum ofa
andb
. - Create a new variable
product_ab
that stores the product ofa
andb
. - Add or update unit tests for these expressions in
tests/test_utils.py
. - Use type hints for any functions if created.
- Do not forget to implement unit tests for expressions
- Create a Python script named
-
task_4 (25 points)
- In the same
src/pytemplate/utils/expressions_example.py
script, add a functioncalculate_and_print()
that prints the sum and product ofa
andb
. - Use type hints for the function arguments, the function should accept a and b as arguments.
- Add or update pytest tests for the reassignment and the function in
tests/test_utils.py
. - Do not forget to implement pytest tests for reassignment and calculation function
- In the same