Question: 4 . Write a python program that Define a function capitalize _ last _ name ( ) that accepts as argument a string with a
Write a python program that Define a function capitalizelastname that accepts as argument a string with a single first and a single last name, and returns a string in which only the first letter of the first name is uppercase, whereas all letters of the last name are uppercase; in otherwords, 'marisa tomei' becomes 'Marisa TOMEI. Tip: use strsplit to split a str into separate words.
If something other than a str object is passed as an argument, the function should raise a TypeError. Tip: you can use isistance to check whether an object is of a particular type. If the str does not consist of exactly two words, the function should raise a ValueError Write a python program that Define a function capitalizelastname that accepts as argument a string with a single first and a single last name, and returns a string in which only the first letter of the first name is uppercase, whereas all letters of the last name are uppercase; in otherwords, 'marisa tomei' becomes 'Marisa TOMEI. Tip: use strsplit to split a str into separate words.
If something other than a str object is passed as an argument, the function should raise a TypeError. Tip: you can use isistance to check whether an object is of a particular type. If the str does not consist of exactly two words, the function should raise a ValueError.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
