Exam 3- 2012

The definition of a function called getnumber that

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the elements of L that are exactly N characters. For example, if L is ['Ke$ha', 'Beyonce', 'Rihanna'] and N is 7, you would return a new list ['Beyonce', 'Rihanna'] o Does not modify the original list L o Does not have any input or print statements 2. The definition of a function called build_list that does the following: o Takes one input parameter: an integer N o Prompts the user for N names o Returns a list of the N names in the order the user typed them 3. The definition of a function called get_number that does the following: o Takes one input parameter: a string S o Prompts the user to enter a number. The prompt to the user should be the string S. o Prints an error message and exits the program immediately if the user does not enter a valid positive number. o Otherwise, returns the number the user entered. 4. A main...
View Full Document

Ask a homework question - tutors are online