Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in the problem so that your code will work for any set of inputs Be sure to include comments in the code to document what

image text in transcribed
in the problem so that your code will work for any set of inputs Be sure to include comments in the code to document what is happening. You may find it useful to write out pseudo code first, and then go back in and fill in the actual code, leaving the pseudo code as your comments. Anytime you have to print out something, be sure is dearly labeled So instead of printing just the number 3, print something descriptive like The length of the input list is 3 1. Write a function named dictKeysOnly that takes in a dictionary. Your function should returm an ordered list of the dictionary keys in ascending order (numeric 0,1,2 or alphabetical a,bc) and should print out how many dictionary keys there are. You may assume that all of the keys will either be strings or numbers 2. Write a function called howManyWordsAndSentences that takes in a string. Your function should return a dictionary where the keys are the order position of each SENTENCE (you may assume sentences will end with periods, exclamation points, or question marks). The data for each key should be a tuple containing the number of words in the sentence and a string containing the sentence itself (you should remove the extra spaces before or after each sentence). Your function should print out how many sentences there are in the input string Ex: For the input string Our class string is I Love Chocolate Milk This may seem silly. But I really do love chocolate milki Your dictionary would have 3 entries The first key would be 1, and the data would be 8 (number of words) and the string "Our class string is I Love Chocolate Milk The second key would be 2, and that data would be 4 (number of words) and the string "This may seem silly. The third key would be 3, and the data would be 7 (number of words) and the string "But I really do love chocolate milk! 3. Write a function called madLib that takes in a string and a dictionary The input dictionary will have keys that are integers and data values that are strings Your function should replace the word in the original string at each key value with the data for that key value. Your function should return an updated string Ex: inputString like chocolate milk Should return the string "we like chocolate cookies You may find the split) and str) functions for strings and lists to be useful INSY 3010-Fol 2018 Homework 4 Due: 8am, Sept 18 Write a function called multiplyNumbersByAConstant that takes in a list of numbers and a single scalar (these can all be integers or floatine point numbers). Using a single list comprehension, make a new list that has the input scalar (number) added to each term in the original list. Your code should return the modified ist Ex: For inputList 1,2,3 and scalar-3, the list you would return is (3,6,9

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

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

What are go/no-go controls?

Answered: 1 week ago