CSC111 Exercises with Lists

From dftwiki3
Revision as of 09:27, 24 March 2014 by Thiebaut (talk | contribs) (Exercise 1)
Jump to: navigation, search

--D. Thiebaut (talk) 09:53, 24 March 2014 (EDT)



Exercise 1


Question 1
Create a list with all the odd numbers between 1 and 100.


Question 2
Create a list with all the odd numbers less than 10,000,000


Exercise 2

Question 1
Split a line of text into a list of words.
Question 2
Reformat the list of words as a string with the |-character as separator instead of a space


Exercise 3

Question 1
Given the text in this page which represents lists of media files, create a list of just the names of the files.
Question 2
Given the text in the same page, find the file that takes the most amount of disk space.
Question 3
List the files as a name followed by a size, one per line
Question 4
Same as Question 3, but sort the list alphabetically
Question 5
Same as Question 3, but sort the list by file size
Question 6
Create a new list that contains only the size, month, day, year and file name for each file. In other words, drop the first 4 fields of each line.