Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Not sure how to do this. The second picture is of the doctest required and all of the specific cases that must be passed. Thanks.

Not sure how to do this. The second picture is of the doctest required and all of the specific cases that must be passed. Thanks.

image text in transcribed

image text in transcribed

Goal: [5pts] Write the function joinedList(n), where n is an integer number. This functions returns (not prints) the list [1,,...2,1] for every n0 and theli n0. If an invalid input is provided, the function must return a string with an error message (the string 'error' is enough) st [n,nt1,n+2, -1, -1, -2..,] for every [5pts] Write the function removePunctuation(xt), where txt is a string. This function returns a string that replaces every character that is not an alphabet letter into a space provided as an input, the function must return a string with an enough). Hint: string method isalpha) . If a string is not Deliverables: Submit your code with the file name LAB2.py to the Lab2 GradeScope assignment before the due date Notes: Verify your code is returning and not printing the output, otherwise, your code will returrn . To provide input to your fiunctions, include -i as an argument in the command line to run . A doctest is provided in the starter code. To run it, type python -m doctest -v LAB2.py None and the test cases will fail an interactive Python session (python -i LAB2.py) Mac users type python3 def joinedList (n): >>>joinedlist (5) 11, 2, 3, 4, 5, 5, 4, 3, 2, 1] >joinedlist (-3) >>>joinedList ('5') 'error' >joinedList ([2,8, I9]1) error' >>>joinedList (0) It 1 T1 # YOU CODE STARTS HERE def removePunctuation (txt): IT TT # txt : string # It replaces every character that is not an alphabet letter # into a space, and returns it. >> removePunctuation ("I like chocolate cake!!! It's the best flavor. . for real") 'I like chocolate cake It s the best flavor for real' ' Dots >>> removePunctuation (55) error' >>>removePunctuation ([3.5, 6]) 'error' many dots X" # YOU CODE STARTS 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_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

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

4. How does social marketing differ from commercial marketing?

Answered: 1 week ago