Question: The sample script named noMoreErrors.py currently contains five errors. Modify the script to remove all errors. As you remove errors, note whether the error resulted

The sample script named noMoreErrors.py currently contains five errors. Modify the script to remove all errors. As you remove errors, note whether the error resulted in a feedback bar message or a traceback message and note the message. Modify the last five lines of the script to report the error messages you encountered. The first two of these have been completed for you already. When the script is repaired, the first portion of the output will look like this:

NoMoreErrors.py b Mucca.gdb Dyer20

DYER #1. FEEDBACK BAR: Failed to check - syntax error - EOL while scanning string literal #2. TRACEBACK: IndexError: string index out of range

Error messages for #35 will also be printed, when the script is complete, but they are omitted here.

code:

# Name: NoMoreErrors.py

dataName = 'Lucca.gdb'

county = 'Dyer'

id = 20

# 1. Print the name of the script.

print 'NoMoreErrors.py

# 2. Print the last chararcter in dataName

print dataName[11]

# 3. Use a string method to change the first letter

# of dataName to M ('Mucca.gdb' not 'Lucca.gdb')

# and print the results

dataName[0] = 'M'

print dataName

# 4. Concatenate county and id and print the results

fullName = county + id

print fullName

# 5. Print the county in all caps.

allCaps = county.upper(0)

print allCaps

# 6. Print the feedback message or the last line of the traceback resulting

# from each erroroneous line in #1-5 before each was repaired. #1 and 2 are

# done for you.

print '#1. FEEDBACK BAR: Failed to check - syntax error - EOL while scanning string literal'

print '#2. TRACEBACK: IndexError: string index out of range'

print "#3. TRACEBACK: ???"

print "#4. TRACEBACK: ???"

print '#5. TRACEBACK: ???'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!