Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Defining a Figure of Merit Consider a string-matching figure of merit. That is, it tells you how close to a given string another string is.

Defining a Figure of Merit

Consider a string-matching figure of merit. That is, it tells you how close to a given string another string is. Each matching letter in the same spot is worth one point. Only letters need be considered.

For instance, if the secret string reads 'BLACKBEARD', then 'BEACKBEARD' is worth 9 points, 'WHITEBEARD' is worth 5 points, 'BEARDBLACK' is worth 4 points, and 'CALICOJACK' is worth 1 point.

Compose a function pirate which accepts a string of characters guess and returns the number of characters which match the secret string 'BLACKBEARD'. It should be case-insensitive; that is, you should convert input to upper-case letters. It should return zero for strings which are not ten characters in length.

Your submission should include a function pirate( guess ) which returns a float or int representing the number of matching characters.(You should provide the secret string 'BLACKBEARD' inside the function, not outside of it.)

python 3

how do I code this

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_2

Step: 3

blur-text-image_3

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions