Question: BlockPy: Review 13) Function in File Define a function convert_emphasis that consumes a single character string and returns 1 if it is a !, 2

 BlockPy: Review 13) Function in File Define a function convert_emphasis that

consumes a single character string and returns 1 if it is a

BlockPy: Review 13) Function in File Define a function convert_emphasis that consumes a single character string and returns 1 if it is a "!", 2 if it is a "?" , or 0 otherwise. Then apply this function to each character in the given file, and calculate the sum. Note: Your function will be unit tested against multiple arguments. It is not enough to get the right output for your own test cases, you will need to be able to handle any single character string. Note: You cannot simply print out a literal value. You must use a looping pattern to calculate for any file like this. Note: You cannot embed the text of the file directly in your program. Use the appropriate file handling style to access the data in the file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!