Respuesta :
Answer:
figure of merit is a quantity used to characterize the performance of a device, system or method, relative to its alternatives. In engineering, figures of merit are often defined for particular materials or devices in order to determine their relative utility for an application.
Following are the Python program to find the string-matching figure:
Python Program:
def pirate(g):#defining the method pirate that takes one variable in parameter
if len(g)!= 10:#defining if block that check the parameter length value that is not equal to 10
return 0 #using the return keyword that return a value that is 0
else:#defining else block
g= g.upper()#defining g variable that converts the parameter value into upper value
secretString = "BLACKBEARD"#defining string variable secretString that holds string value
c = 0#defining integer variable c that holds integer value
for i in range(0, len(g)):#defining loop that counts and check value is in string variable
if g[i] == secretString[i]:#defining if block that checks value in secretString variable
c += 1; #defining c variable that increments its value
return c;#using return keyword that return c value
print(pirate("BEACKBEARD"))#using print method that calls pirate method and prints its value
print(pirate("WHITEBEARD"))#using print method that calls pirate method and prints its value
print(pirate("BEARDBLACK"))#using print method that calls pirate method and prints its value
print(pirate("CALICOJACK"))#using print method that calls pirate method and prints its value
Output:
Please find the attached file.
Program Explanation:
- Defining the method "pirate" that takes one variable "g" in parameter.
- Inside the method an if block that checks the parameter length value that is not equal to 10, and uses the return keyword that returns a value that is 0
- In the else block, define the "g" variable that converts the parameter value into the upper value, and use a string variable "secretString" that holds the string value.
- In the next step, define an integer variable "c" that holds an integer value, and define a loop that counts and checks the value in a string variable.
- Inside this, define if block that checks the value in the "secretString" variable, increments the "c" value, and returns the "c" value.
- Outside the method, a print method that calls the "pirate" method prints its value.
Find out more about the string-matching here:
brainly.com/question/16717135
