Skip to content

PEPLabs/PY-CL-Input_Output

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PY-CL-Input_Output

Overview

This project focuses on handling user input and output operations in Python. It includes functions to interactively collect user input as strings, integers, and floats. Additionally, it demonstrates how to mock user input for testing purposes. The project consists of three main files: app.py, lab.py, and lab_test.py.

Files

app.py

The app.py file serves as the main script for the project. It allows users to input their name as a string, age as an integer, and height as a float. The inputs are validated to ensure they are of the correct data type, and appropriate error messages are displayed if invalid input is provided.

lab.py

The lab.py file contains the implementation of functions for collecting user input. It includes functions to collect input as strings, integers, and floats, with validation to handle incorrect input types.

lab_test.py

The lab_test.py file contains unit tests for the functions defined in lab.py. It uses mocking to simulate user input and verifies that the functions correctly handle different input scenarios.

Project Structure

  • src/
    • main/
      • app.py
      • lab.py
    • test/
      • lab_test.py

Getting Started

  • Open the app.py file in the src/main directory.
  • Run the app.py file to interactively collect user input.
  • Follow the prompts to input your name, age, and height, ensuring you provide inputs of the correct data types.
  • Review the implementation of functions in lab.py to understand how user input is collected and validated.

Testing

  • Open the lab_test.py file in the src/test directory.
  • Run the lab_test.py file to execute the unit tests.
  • Ensure that all tests pass, indicating that the implemented functions handle user input correctly.

Conclusion

This project provides practical examples of handling user input and output in Python. By exploring the functions in lab.py and running the tests in lab_test.py, users can learn how to collect and validate user input effectively, improving their Python programming skills.

Happy Coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages