Changes

Jump to: navigation, search

OPS435 Python Lab 5

143 bytes added, 10:22, 5 September 2017
INVESTIGATION 2: Exceptions and Error Handling
</source>
:::'''append_file_string():'''::::#Takes '''two string arguments'''::::#'''Appends ''' to the file(Argument 1) all data from the string(Argument 2):::'''write_file_list():''' ::::#Takes two arguments, : a '''string ''' and a '''list'''::::#'''Writes ''' to file(Argument 1) all lines of data found in the list(Argument 2):::'''copy_file_add_line_numbers():'''::::#Takes two arguments, both : '''Both are files path-names''' (which happen to be strings, both filesnames)::::#'''Reads ''' all data from first file(Argument 1), and writes all lines into secon second file(Argument 2) '''adding ''' line numbers::::#Line numbers should be added to the '''beginning ''' of each line with a colon next to them(see sample outputbelow for reference)::::#'''Hint: review ''' Review the '''len() ''' and '''range() ''' functions from '''lab 3 ''' and '''lab 4'''
::::'''Sample Run 1:'''<source lang="python">
= INVESTIGATION 2: Exceptions and Error Handling =
 :Running into errors in programming will be a common occurrence. In python when a error occurs, python raises a python object called an exception, which represents the error that occured. These exceptions are raised when python is no long able to handle what the code is trying to do. This section will give the programmer the ability to catch these exceptions when they happen and allow the program to continue running, however in many cases it might be a good idea to stop the program when an exception happens anyway.
== PART 1 - Handling Errors ==
13,420
edits

Navigation menu