This project demonstrates various type casting operations in Python. It includes functions to convert integers, floats, and strings to different data types. The project also includes an entry point script (app.py) to interactively demonstrate the functionality, along with unit tests (lab_test.py) to ensure the correctness of the implemented functions.
The app.py file serves as the main entry point for the project. It allows users to interactively test the type casting functions implemented in lab.py. Users can input different values and see the results of the type casting operations.
The lab.py file contains the implementations of various type casting functions. Each function is documented with instructions on how to use it and what it does. The functions include converting integers to floats, floats to integers, strings to integers, strings to floats, integers to strings, floats to strings.
The lab_test.py file contains unit tests for the functions defined in lab.py. It ensures that the implemented functions behave as expected by testing them with various input cases. The tests cover scenarios such as converting valid and invalid inputs to different data types.
- src/
- main/
- app.py
- lab.py
- test/
- lab_test.py
- main/
- Open the
src/main/app.pyfile. - Run the
app.pyfile to interactively test the type casting functions. - Follow the prompts to input values and see the results of the type casting operations.
- Refer to the instructions provided in the docstrings of each function in
lab.pyfor guidance on usage.
- Open the
src/test/lab_test.pyfile. - Run the
lab_test.pyfile to execute the unit tests. - Ensure that all tests pass, indicating that the implemented functions are working correctly.
This project provides hands-on experience with type casting in Python. By exploring the functions in lab.py and running the tests in lab_test.py, users can enhance their understanding of type conversions and improve their Python programming skills.
Happy Coding!