Changes

Jump to: navigation, search

OPS435 Python Lab 5

215 bytes removed, 05:26, 4 September 2017
Create a Python Script Which Handles Errors
print(add('10',5)) # works
print(add('abc',5)) # exception
print(read_file('seneca1seneca2.txt')) # works
print(read_file('file10000.txt')) # exception
15
error: could not add numbers
['Line 1\n', 'Line 2 is a little longer\n', 'Line 3 is too\n', 'This is the forth line\n', 'Final line in file\n']
error: could not read file
</source>
'error: could not add numbers'
lab5c.read_file('seneca1seneca2.txt')['Line 1\n', 'Line 2 is a little longer\n', 'Line 3 is too\n', 'This is the forth line\n', 'Final line in file\n']
lab5c.read_file('file10000.txt')
198
edits

Navigation menu