set_expected_answer
set_expected_answer
Tell the recognizer how many digits the caller’s answer in this step has, such as a ZIP code or a PIN. The recognizer stops waiting once the caller has said that many digits.
While a gather question with its own expected_answer is being asked, that
value replaces the step’s. See
add_gather_question() and
expected_answer().
Pass digits for an exact count, or both min_digits and max_digits for a
range.
Parameters
digits
The exact number of digits, from 1 to 64. Can’t be combined with
min_digits or max_digits.
min_digits
Keyword-only. The fewest digits, from 1 to 64. Requires max_digits.
max_digits
Keyword-only. The most digits, from 1 to 64, and at least min_digits.
Requires min_digits.
Returns
Step — Self for method chaining.
Raises
ValueError for a count outside 1 to 64, a min_digits greater than
max_digits, digits combined with a range, or a range with only one end.
Examples
Exact count
The step renders as: