Saint Louis University |
Computer Science 1300
|
Computer Science Department |
Please make sure you adhere to the policies on academic integrity.
Assume that tokens is a list of strings read from a
text file, that represent numeric values (e.g.,
Give a single line that uses comprehension syntax to produce a
new list, named vals, which are the corresponding
integer values (e.g.,
Assume that nouns is a list of strings. Given a line that produces a new list, plural, containing all of the original words that end with the character 's'. (Yes, I realize that these might not actually represent plurals, but this is just an exercise.)
Consider the goal of creating an acronym for a phrase by
capitalizing the first letter of each word, such as the
acronym 'LOL' for the phrase
initials = [] for word in phrase.split(): initials.append(word[0].upper()) acronym = ''.join(initials)
Your task is to give a single line of code of the form
acronym = ???that accomplishes the above task.