Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to create or implement a python program that lists 2 pre-set books to search, or accept user data. For example we want we to

How to create or implement a python program that lists 2 pre-set books to search, or accept user data.

For example we want we to pre-populate a list of test examples in pre-defined array. We'll want to be able to add to this array. Each item in the array should be in

"tag", "nz_mms_id" format:

presetlist[0] = ["Cather","9910103442003692"]

presetlist[1] = ["Turtles","9910728042003692"]

This list should be presented to the user when the program starts (starting from 0 is okay)

0.Cather

1.Turtles

The user is then prompted to enter a number 0-(whatever) OR enter their own nz_mms_id

WELCOME TO THE CLICK BOOK SEARCH REQUEST Preset Examples: 0. Cather 1. Turtles Please choose a preset example (0-1) or enter your own nz_mms_id: > 

Validation

If a user enters anything less than 3 characters in length, then it should be treated as a preset option.

If a user enters a number that is not part of the preset list then a message should be shown to the user "X is not an option. Please try again."

If a user enters a string that is more than 3 characters in length, but less than 16, then a message should be shown: "Invalid nz_mms_id. Must be 16 characters in length. Please check for typos"

Results

For now, after the user enters a number (or full nz_mms_id) just return the nz_mms_id:

You chose: {{nz_mms_id}} This is what I found: (PLACEHOLDER) Would you like to choose another book? Y/N > 

Please help explain.....

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions