Difference between revisions of "CSC111 Exercises with Lists"
(Created page with "--~~~~ ---- =Exercise 1= Create a list with all the odd numbers between 1 and 100. =Exercise 2= ;Question 1 :Given the text in this page, create a ...") |
|||
Line 5: | Line 5: | ||
=Exercise 2= | =Exercise 2= | ||
+ | Split a line into a list of words | ||
+ | =Exercise 3= | ||
;Question 1 | ;Question 1 | ||
− | :Given the text in this [[CSC111 List of videos| page]], create a list of just the names of the | + | :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. |
;Question 2 | ;Question 2 | ||
− | :Given the text in the [[CSC111 List of videos| same page]], find the | + | :Given the text in the [[CSC111 List of videos| 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. | ||
<br /> | <br /> | ||
<br /> | <br /> |
Revision as of 10:02, 24 March 2014
--D. Thiebaut (talk) 09:53, 24 March 2014 (EDT)
Exercise 1
Create a list with all the odd numbers between 1 and 100.
Exercise 2
Split a line into a list of words
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.