In this problem, you should write one function named two_words. This function should accept one parameter, which you can

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In this problem, you should write one function named two_words. This function should accept one parameter, which you can

Post by answerhappygod »

In this problem, you should write one function named two_words.This function should accept one parameter, which you can assumewill be a list with one or more strings in it, each being a word.Using a for-loop, the function should determine the word that wouldcome first and last in the alphabet from the list of words. Thefunction should return these two words concatenated together, withone space in-between. The alphabetically0earlier word should befirst.
A few examples:
The function call two_words(['tree', 'forest', 'antelope','zebra'])
should return the string 'antelope zebra'.
The function call two_words(['zoo', 'champion', 'fetch','those', 'lemurs'])
should return the string 'champion zoo'.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply