Course Home | Class Schedule | Moodle CMS | Git Submission | Perusall | Tutoring

Saint Louis University

Computer Science 1300/5001
Introduction to Object-Oriented Programming

Michael Goldwasser

Fall 2019

Computer Science Department

Homework Assignment 09

Please make sure you adhere to the policies on academic integrity.


  1. (6 points)

    Assume that tokens is a list of strings read from a text file, that represent numeric values (e.g., ['23', '35', '8', '200']).

    Give a single line that uses comprehension syntax to produce a new list, named vals, which are the corresponding integer values (e.g., [23, 35, 8, 200]).

  2. (6 points)

    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.)

  3. (8 points)

    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 'laughing out loud'. We could accomplish the goal using traditional techniques as in the following:

    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.


Michael Goldwasser
CSCI 1300/5001, Fall 2019
Last modified: Sunday, 22 December 2019
Course Home | Class Schedule | Moodle CMS | Git Submission | Perusall | Tutoring