Cover page images (keyboard)

I/O Lab

Sue Evans


Overview

Objectives for today's lab:

Grade Report

Getting Started

What we are about to do (overall)

Step 0 - File open/close

Step 1 - Iterating through a file


.. header, functions, etc...

def main():

	#open files for input and output respectfully

	#create for loop to read all data from a file

	    .. rest of the orginal code here (INDENTED!!!)


	#close files 



main()


Step 2 - Splitting up the line of data read in


.. header, functions, etc...

def main():

	#open files for input and output respectfully

	#create for loop to read all data from a file

	    #split line into 'tokens', reuse courseDataList

	    courseDataList = line.split()

	    .. rest of the orginal code here (INDENTED!!!)


	#close files 



main()


Step 3 - Getting the name out of our courseDataList


.. header, functions, etc...

def main():

	#open files for input and output respectfully

	#create for loop to read all data from a file
   
	    #split line into 'tokens', reuse courseDataList

	    #create a variable called "name"
	    #grab the name from the list and place into "name".
	    #remove the "name" from the list using it's index number


	    .. rest of the orginal code here


	#close files 



main()


Step 4 - Converting courseDataList from Strings to Floats


.. header, functions, etc...

def main():

	#open files for input and output respectfully

	#create for loop to read all data from a file

	    courseDataList = []
   
	    #split line into 'tokens', reuse courseDataList

	    #create a variable called "name"
	    #grab the name from the list and place into "name".
	    #remove the "name" from the list using it's index number

	    #create loop to travel through all of courseDataList
	  	    #type cast here to convert all elements from strings to float

	    .. rest of the orginal code here


	#close files 


main()

Step 5 - On your own!!

Bonus Task

Challenge Problem