Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON, capitalize or join words. The code missing is specified as ------missing code-----. Thank you. CODE def capitalize_or_join_words(sentence): --------------------------------------missing code------------------------------------------------------- string = *i love python

PYTHON, capitalize or join words. The code missing is specified as ------missing code-----. Thank you.

image text in transcribed

CODE

def capitalize_or_join_words(sentence):

--------------------------------------missing code-------------------------------------------------------

string = "*i love python" assert_equal("I LovE PythoN",capitalize_or_join_words(string))

string = "i love python" assert_equal("i,love,python",capitalize_or_join_words(string))

string = "i love python " assert_equal("i,love,python",capitalize_or_join_words(string))

def capitalize_or_join_words ( sentence): If the given sentence starts with *, capitalizes the first and last letters of each word in the sentence, and returns the sentence without *. Else, joins all the words in the given sentence, separating them with a comma, and returns the result. For example: - If we call capitalize_or_join_words("*i love python"), we'll get "I LOVE Python" in return. - If we call capitalize_or_join_words ("i love python"), we'll get "i,love, python" in return. - If we call capitalize_or_join_words("i love python "), we'll get "i,love, python" in return. Hint(s): - The startswith() function checks whether a string starts with a particualr character - The capitalize() function capitalizes the first letter of a string - The upper() function converts all lowercase characters in a string to uppercase The join() function creates a single string from a list of multiple strings # your code here

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

Step: 3

blur-text-image

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago