For example how many grades are below average variable

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nside of it? • Accessing list values is repe..on  ­> while loops! Accessing Lists using while loops 5 13 ­09 ­23 Using Lists to store words  ­ Example • Loops repeat un\l the user types ‘S’ to stop Applica\ons of Lists •  Lists are good for storing mul\ple values •  Storing a bunch of values in individual variables gets messy fast •  Use lists to store mul\ple related values Applica\ons of Lists •  When we store mul\ple values together, we are able to analyze them. For example, how many grades are below average. VARIABLE = EXPRESSION a variable is a name for an address in memory where we store useful data expressions determine how the calcula9ons in the program are made 6 13 ­09 ­23 Another Applica\on of Lists •  When asking input, we onen want to ignore case: “Y” or “y” are equally good as posi\ve answers •  Op\on 1: Boolean or •  Op\on 2: fix the case of the answer •  Op\on 3: use the in test Itera\ng over the elements in a list •  So far we have used while to view every value, or element, in a list •  To use while, we need to maintain an index variable •  But there’s an easier w...
View Full Document

This document was uploaded on 03/02/2014.

Ask a homework question - tutors are online