CS 683 Emerging Technologies

Fall Semester, 2005

Assignment 1

Assignment Index

© 2005, All Rights Reserved, SDSU & Roger Whitney

 San Diego State University -- This page last updated 9/1/05

Assignment 1

Due Sept 8

You are to turn in hard copy of your assignment. Please indicate on your paper your status in the course, that is if you are enrolled in the course or are a crasher.

Late homework will be accepted, but with a penalty. An assignment turned in 1-7 days late, will lose 3% of the total value of the assignment per day late. The eight day late the penalty will be 40% of the assignment, the ninth day late the penalty will be 60%, after the ninth day late the penalty will be 90%. Once a solution to an assignment has been posted or discussed in class, the assignment will no longer be accepted. Late penalties are always rounded up to the next integer value.

1. Tuples are immutable. Explain the output of the following Python code.

a = [1,2]

b = (9, a)

c = b*2

a[0] = 'dog'

print c

2. Explain what is going on with the assignment statement below.

a = 'cat'

b = 'dog'

a, b = b, a

3. What is the result of executing the following code. Explain the results.

a = 'cat'

a[0][0][0]

4. Given the assignment a = [1, 2, 3, 4, 5] what is the slice a[4:2]? What effect does the assignment a[4:2] = ['cat', 'dog] have?

5. Write a function that returns the sum of the ACII code of each character its string argument.

6. Write a function that returns a copy of its dictionary argument.

7. Write a Python program that reads a file, replaces all occurrences of <guid> wth <guid isPermaLink="true">, and then writes the result to a different file.