Given a folder with images and sounds in it, create an index HTML page with links to each image and sound.
You will write a function called indexPage that takes a string which is the path to a directory. You will create a page in that directory named index.html. Index.html should be an HTML page containing a link to every JPEG file and every WAV in the directory. At the top of the page, put a heading (level 1) with the phrase "Directory listing of sounds and images in " and then the directory, e.g., "Directory listing of sounds and images in C:\Documents and Settings\Mark Guzdial\mediasources"
The links should be each an item in an unordered (<ul>) list. The anchor text in each link should be the filename of the image or sound. The destination (href) should be the same filename.
For each image, on the same line as the filename, list the horizontal and vertical size (in pixels) of the image.
For each sound, list the length of the sound in seconds.
Clicking on "barbara.jpg" above should display that file. Clicking on "hello.wav" should go to that sound (as the destination of the link)–and if your browser and sound card as set up appropriately, you should hear the sound.
Turn in your program via JES as "exam2". Your filename should be "exam2.py" Your function name should be indexPage
This is a NON-COLLABORATIVE ACTIVITY! You may not talk to anyone about their code, nor look at anyone else's code, nor allow anyone to see your code. This is a TAKE HOME EXAM. It is an "open book" exam. You may use your book, any slides, any material in the CoWeb, and any programs you've written (even with others) that you already have direct access to.
Ask questions on Spring 2003 Take Home Exam 2 but be sure to ask questions only about objectives and process. You are welcome to ask questions about any of the programs in the book or in the slides, but you cannot ask anyone (even the TA's or teacher) about your own solution.
When you turn in your exam, you are to enter into the Comment area the statement: "I did not provide nor receive any aid on this exam." IF YOU CANNOT MAKE THAT STATEMENT TRUTHFULLY, DO NOT SUBMIT YOUR EXAM! ANY EXAM WITHOUT THAT STATEMENT WILL NOT BE GRADED.
Take Home Exam #1:
At the Feb. 7 class, we recorded this sound thisisatest2.wav ("This is a test."). Using MediaTools, we found the end points for each of the words in the sound:
Recorded word
Index where it stops in the sound
This
7865
is
27170
a
40326
test.
55770
Write a function backSpliced that splices the last word ("test") into the front of the word, but backwards, so that the result is: tsetisatest.wav ("Tset is a test.") It's okay if you have a variable that directly refers to the file on your disk: Your TA will fix it to point to his or her file when testing the program.
Some suggestions:
Understand Recipe 15 (page 85). See the lecture notes for Feb. 10 on what it means to understand a program.
Understand Recipe 14 (page 83), but you may want to build your program by editing the simpler splice on page 84. (That's how I wrote my solution to generate the above sound.) Be sure to use the slides for a more accurate version of Recipe 14.
To do this right, you will write and run more lines of code than you put in your final solution. Do work at understanding the problem, then writing your solution.
This is a NON-COLLABORATIVE ACTIVITY! You may not talk to anyone about their code, nor look at anyone else's code, nor allow anyone to see your code. This is a TAKE HOME EXAM. It is an "open book" exam. You may use your book, any slides, any material in the CoWeb, and any programs you've written (even with others) that you already have direct access to.
Ask questions on Spring 2003 Take Home Exam 1 but be sure to ask questions only about objectives and process. You are welcome to ask questions about any of the programs in the book or in the slides, but you cannot ask anyone (even the TA's or teacher) about your own solution.
Turn in your program via JES as "exam1". When you turn in your exam, you are to enter into the Comment area the statement: "I did not provide nor receive any aid on this exam." IF YOU CANNOT MAKE THAT STATEMENT TRUTHFULLY, DO NOT SUBMIT YOUR EXAM!