We also might want to look at only valid words in our data set. A word will be a valid word if all three of the followin

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: 899604
Joined: Mon Aug 02, 2021 8:13 am

We also might want to look at only valid words in our data set. A word will be a valid word if all three of the followin

Post by answerhappygod »

We also might want to look at only valid words in our data set.
A word will be a valid word if all three of the following
conditions are true:
There is at most one punctuation
mark. If present, it must be at
the end of the word ("ab,", "cd!",
and "." are valid,
but "a!b" and "c.," are not valid).
NB: for this question, the 3rd condition will also apply to
apostrophes despite "valid" words containing them.
Write a function valid_words_mask(sentence) that takes
an input parameter sentence (type string) and returns the
tuple: (int, list[]), where:
*Assume that a punctuation mark is any character that is not an
alphanumeric (except for hyphens, which are handled separately as
per the instructions).
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply