Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a function called alphabetical(sentence) that takes in a sentence as a string and returns a list of the words in the sentence in alphabetical

Create a function called alphabetical(sentence) that takes in a sentence as a string and returns a list of the words in the sentence in alphabetical order. Hint #1: Use string methods to convert the sentence into a list, and list methods to properly order the list! Hint #2: Remember that uppercase letters are alphabetically before lowercase, as shown in the examples below. You dont need to worry about correcting this. Examples: alphabetical(Welcome to CSC111!) returns [CSC111!, Welcome, to] alphabetical(Do your homework) returns [Do, homework, your] alphabetical(Python: more than a snake) returns [Python:, a, more, snake, than] When you are confident everything in your script is working correctly, submit your homework7.py file below.

image text in transcribed

Coding Practice Create a new python script called homework7.py. You will define the following function in your script. Once you've run your script and ensured that it is correct, upload the script to the submission box below. Be sure to document your function as described in lab slides 3 and fill out the top portion of the template, including the Worklog and Acknowledgements sections. Create a function called alphabetical(sentence) that takes in a sentence as a string and returns a list of the words in the sentence in alphabetical order. Hint #1: Use string methods to convert the sentence into a list, and list methods to properly order the list! Hint #2: Remember that uppercase letters are alphabetically before lowercase, as shown in the examples below. You don't need to worry about correcting this. Examples: alphabetical("Welcome to CSC111!") returns ["CSC111!" "Welcome" "to"] alphabetical(Do your homework") returns ["Do", "homework your] alphabetical("Python: more than a snake") returns [Python:", "a", "more","snake" "than"] When you are confident everything in your script is working correctly, submit your homework7.py file below

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

What is the relationship between a switch and a bridge?

Answered: 1 week ago

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago