Part 2 Troubleshooting: Being able to troubleshoot scripts is a critical skill that needs to be developed and a good IDE will provide feedback to help you avoid and correct syntax errors. Review the...

1 answer below »










Part 2 Troubleshooting:


Being able to troubleshoot scripts is a critical skill that needs to be developed and a good IDE will provide feedback to help you avoid and correct syntax errors. Review the script below and determine which lines are producing the syntax errors.



  1. After testing the For Loop, copy and paste the code below into the same file.

  2. Comment out the line with the error and write the correct code underneath. Include a comment describing the nature of the error.



zoo = ['Lion', 'Zebra', 'Giraffe', 'Hippo']  for animal in zoo:     if animal == "Lion':         print "Alex the " + animal     elif animal == 'Zebra':         print "Marty the " + Animal     elif animal == 'Giraffe':         print "Melman the " + animals     elif animal == 'Hippo':         print "Gloria the " + animal


Part 3 Implementation:


As the Lead Engineer in the ultra-secret spy organization, you have been tasked with assigning Code Names for all Secret Spy Missions.


Your mission is to complete the attached script.



  1. Continuing on the same file. Just below the troubleshooting activity. Copy and paste the code below.

  2. Create a nested For loop that will select a single random name from each of the provided lists below.

  3. Concatenate both words(variables) together and print the "Code Names" to the screen each time it is run. (Use the print statement that is already included.)

  4. If you have done everything correctly, then the code will return five (5) random Code Names.


    1. Ex: Operation: Palisade Iceberg




# Import the Random Module import random  # Code Name Lists alpha = ['Crimson', 'Phantom', 'Zephyr', 'Palisade', 'Skyfall'] omega = ['Whirlwind', 'Gatecrasher', 'Iceberg', 'Zealot', 'Element']  # 1.CREATE FOR LOOP HERE # HINT: You will have a nested For loop.  # 2. The Random Code Names will print here.  # HINT: Remember your indentions.  print ("Operation: " + random.choice(alpha) + " " + random.choice(omega))

Answered Same DayOct 07, 2021

Answer To: Part 2 Troubleshooting: Being able to troubleshoot scripts is a critical skill that needs to be...

Dinesh answered on Oct 08 2021
134 Votes
5-python-assignment/02-troubleshooting.py
zoo = ['Lion', 'Zebra', 'Giraffe', 'Hippo']
for animal i
n zoo:
# if animal == "Lion': XXXXXXXXXX
'''
Above line conditon value surrounded by both single & Double quotes which causes error
we sould not add anthing after colon(:) this will cause indentation problem.'''

if animal == "Lion":
# print "Alex the " + Animal
'''
In for loop iterator is animal which is all lower case in print statement
A is upper case. and print statement should surround by () brackets. unless it's python version 2.X
'''
print("Alex the " + animal)
# elif animal ==...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here