Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions