Overview

Project details

A simple project to practice variable assignments in Python.


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 the src/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
  • task_2 (15 points)
    • In the same src/pytemplate/utils/variables_example.py add a function print_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

launch_2

  • task_3 (20 points)
    • Create a Python script named expressions_example.py in the src/pytemplate/utils/ folder.
    • Assign integer variables a and b with values.
    • Create a new variable sum_ab that stores the sum of a and b.
    • Create a new variable product_ab that stores the product of a and b.
    • 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
  • task_4 (25 points)
    • In the same src/pytemplate/utils/expressions_example.py script, add a function calculate_and_print() that prints the sum and product of a and b.
    • 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
Log in to launch project