Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON Write a function score_input() that takes a test_name, test_score, and invalid_message that validates the test_score, asking the user for a valid test score until

PYTHON

Write a function score_input() that takes a test_name, test_score, and invalid_message that validates the test_score, asking the user for a valid test score until it is in the range, then prints valid input as 'Test name: ##'.

Open project Module6 with directories more_functions and test_functions. Add files validate_input_in_functions.py and test_valid_input_in_functions.py in the appropriate directories.

The test_name is mandatory and will not need validation. The test_score is optional, with default value of 0 (zero), and will be between 0-100. The invalid_message is optional, with default value 'Invalid test score, try again!' Write unit tests that demonstrate the following:

Function score_input() has only the mandatory argument 1 unit test test_score_input_test_name Function score_input() has the mandatory argument and one optional argument for test_score 4 unit tests one good input test_score_input_ test_score_valid one below range test_score_input_ test_score_below_range one above range test_score_input_ test_score_above_range one non-numeric input (make sure you account for an exception) test_test_score_non_numeric Has all arguments 1 unit test test_score_input_invalid_message Write your function score_input() and the parameters list with a docstring as your first line declaring what the function does, include reST :param and :returns in the doctring. For the function body add return pass. In later module you will learn about dictionaries, then you could return a key value pair ('test name',score). Add a comment # return { test_name: test_score} before the return statement for later use. Write unit tests. Write your function so test_score_input_test_name passes. Write your function so test_score_input_ test_score_valid passes Write your function so test_score_input_ test_score_below_range and test_score_input_ test_score_above_range passes. Write your function so test_test_score_non_numeric passes. Check that test_score_input_invalid_message passes. If not, fix the code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistical And Scientific Database Management International Working Conference Ssdbm Rome Italy June 21 23 1988 Proceedings Lncs 339

Authors: Maurizio Rafanelli ,John C. Klensin ,Per Svensson

1st Edition

354050575X, 978-3540505754

More Books

Students also viewed these Databases questions

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago