Question: CSCI 203 Introduction to CS I; Practice Problems 1. What does the following code print? a [1, 2, 3, 41 bI21 6 print { 'a-,

 CSCI 203 Introduction to CS I; Practice Problems 1. What does

CSCI 203 Introduction to CS I; Practice Problems 1. What does the following code print? a [1, 2, 3, 41 bI21 6 print { 'a-, a, 'b-, b) explain the answer printed in 2 problem number 1 3. What is printed when you invoke prob3()? def eat(x): x[119 x131-11 def prob3 0 Eoodt, 5, 6,7 eat (food) print('food, food) problem number 3. 5. Write a function create2DArray with two inputs height and width that creates and returns a 2D array (ie., a list of lists) with values that are the row number multiplied by the column number. For example >>>create2DArray (3, 5) Lt0, 0, 0, 0, 0, [0, 1, 2, 3, 41, 0, 2, 4, 6, 8]1 6. Write a function addOne with one input anArray which is a 2D array (a list of lists). Your function will add 1 to each element of anarray. For example >>> myArray create2 DArray (3,5) >>> addone (myArray) >>>myArray 7. Create a Python class named Phonebook. Add an inst method that creates an attribute called phonebook. Initialize phonebook to be a dictionary with the following names and phone numbers: Bob 72345, Sally 71000, John 79999. Make the name the key and the phone number the value. Make the phone number an int. 8. Add a method ?sName Present to your Phonebook class. It will have a name as a parameter. It will return True if the name is present in the phonebook, False otherwise. Here is an example that demonstrates how to use this method, >>> book -Phonebook () >>> book.isName Present ('Foo) False >>> book,?sName present ("Bob,) True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!