Difference between revisions of "CSC111 Exercises with Lists"

From dftwiki3
Jump to: navigation, search
(Exercise 1)
Line 25: Line 25:
 
=Exercise 3=
 
=Exercise 3=
 
;Question 1
 
;Question 1
:Given the text in this [[CSC111 List of videos| page]] which represents lists of media files, create a list of just the names of the files.
+
:Given the text in the first list of this [[CSC111 List of videos| page]] which represents lists of media files, create a list of just the names of the files.
  
 
;Question 2
 
;Question 2
:Given the text in the  [[CSC111 List of videos| same page]], find the file that takes the most amount of disk space.
+
:Given the list on the  [[CSC111 List of videos| same page]], find the file that takes the most amount of disk space.
  
 
;Question 3
 
;Question 3

Revision as of 10:49, 24 March 2014

--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


Figure out a way to print the list in an efficient and elegant way


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 the first list of this page which represents lists of media files, create a list of just the names of the files.
Question 2
Given the list on 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.