< Back

Test 1 Coding Portion

This is a closed book, closed note, closed files test. You are allowed to access only the files related to your program you are writing here. You are allowed the front half of a standard 8 1/2 x 11 sheet of paper for any handwritten notes.

When you are done, submit your file on inquire.


Spacing

In a file called spacing.py, write a function called space_out(a_string). This function should print a copy of the a_string parameter, with a space inserted after every character.

(15 points)

Example

====== Loading Program ======
>>> space_out("INQ 241")
I N Q   2 4 1 
>>> space_out("Computer Science")
C o m p u t e r   S c i e n c e

Bonus

Write an additional function space_out_2(a_string, num_spaces), which replaces only the spaces in a_string with num_spaces number of spaces.

(5 points)

    >>> space_out_2("INQ 241", 3)
    INQ   241   
    >>> space_out_2("Computer Science", 2)
    Computer  Science