Difference between revisions of "CSC111 Exercises with Lists"
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 09:53, 24 March 2014 (EDT) | --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 09:53, 24 March 2014 (EDT) | ||
---- | ---- | ||
+ | __TOC__ | ||
+ | <br /> | ||
+ | |||
=Exercise 1= | =Exercise 1= | ||
Create a list with all the odd numbers between 1 and 100. | Create a list with all the odd numbers between 1 and 100. | ||
+ | <br /> | ||
=Exercise 2= | =Exercise 2= | ||
;Question 1 | ;Question 1 | ||
Line 11: | Line 15: | ||
: Reformat the list of words as a string with the |-character as separator instead of a space | : Reformat the list of words as a string with the |-character as separator instead of a space | ||
+ | <br /> | ||
=Exercise 3= | =Exercise 3= | ||
;Question 1 | ;Question 1 |
Revision as of 09:06, 24 March 2014
--D. Thiebaut (talk) 09:53, 24 March 2014 (EDT)
Contents
Exercise 1
Create a list with all the odd numbers between 1 and 100.
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.