fix_title: takes in a string argument that is formatted as such -- "TYPE:tHe titLe Of tHe ContENT". Should return the title, based on the following criteria: o If the type in the input argument is "book" in any style of casing, return just the title in title- case. Example: fix_title("boOK:tHe gREat gatSBY") should return 'The Great Gatsby'. o If the type in the input argument is "ARTICLE" in any style of casing, return just the title in upper-case. · Example: fix_title("ArtiCLE:commUNICatiON effICENt MachINE leaRNINg") should

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

Implement the following function:

Code should be written in python. 

fix_title: takes in a string argument that is formatted as such -- "TYPE:tHe titLe Of tHe ContENT".
Should return the title, based on the following criteria:
o If the type in the input argument is "book" in any style of casing, return just the title in title-
case.
Example: fix_title("boOK:tHe gREat gatSBY") should return 'The Great Gatsby'.
o If the type in the input argument is "ARTICLE" in any style of casing, return just the title in
upper-case.
Example: fix_title("ArtiCLE:commUNICatiON effICENt MachINE leaRNINg") should
return 'COMMUNICATION EFFICIENT MACHINE LEARNING'.
o If the type in the input argument is anything else, return just the title in lower-case.
Example: fix_title("tRAsh:This IS NONSense") should return 'this is nonsense'.
Transcribed Image Text:fix_title: takes in a string argument that is formatted as such -- "TYPE:tHe titLe Of tHe ContENT". Should return the title, based on the following criteria: o If the type in the input argument is "book" in any style of casing, return just the title in title- case. Example: fix_title("boOK:tHe gREat gatSBY") should return 'The Great Gatsby'. o If the type in the input argument is "ARTICLE" in any style of casing, return just the title in upper-case. Example: fix_title("ArtiCLE:commUNICatiON effICENt MachINE leaRNINg") should return 'COMMUNICATION EFFICIENT MACHINE LEARNING'. o If the type in the input argument is anything else, return just the title in lower-case. Example: fix_title("tRAsh:This IS NONSense") should return 'this is nonsense'.
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT