As a Support Technician aboard the United Solar Republic Battle Cruiser Ares , you are tasked with testing the Self Destruct Script. You will need the following Command codes: Commanding Officer...

1 answer below »

As a Support Technician aboard the United Solar Republic Battle CruiserAres, you are tasked with testing the Self Destruct Script. You will need the following Command codes:



  • Commanding Officer Initiate Code:111A-Destruct

  • Executive Officer Initiate Code:21A2B-Destruct

  • Chief of Engineering Initiate Code:31B2B-Destruct

  • Self Destruct Confirmation Code:000-Destruct-0



NOTE:Do not substitute a 1 for the last zero in the Activate Code or you will blow up the ship! (P.S. You should ABSOLUTELY substitute the last zero for a 1)


You are tasked with troubleshooting the code below. Place your solutions as comments in the code where appropriate. Each resolution is worth 8 points.









































Objective
1. Complete header comments at the top of the script.
2. Describe how the includedcountdown(n)script works
3. Within the self_destruct() function, create variables for the
Commanding Officer's Code (co_code), the Executive Officer's Code
(xo_code), and Chief Engineer's Code (ce_code).
4. Explain the significance of the int() function.
5. Explain the significance of x.
6. List the Local Variables and the Global Variables used in the script.
7. List the Built-in Functions used in the script.
8. List the imported Module Functions (if any) used in the script
9. List the custom functions used in the script.



# 1. ADD PROPER HEADERS # # ################################################################################################### import time # Custom Functions # 2. DESCRIBE HOW THE INCLUDED countdown() FUNCTION WORKS # A: def countdown(n): while n >= 0: print (n) time.sleep(1) n -= 1 ################################################################################################## # Self Destruct Sequencer # This is the custom function created to handle all of the Self Destruct # features needed. There are a few steps involved in the process, so take a few # moments to study how this function works and think about ways to make it better. def self_destruct(x): # Set Destruct Codes authorized_test = "000-Destruct-0" authorized_final = "000-Destruct-1" # 3. CREATE VARIABLES (SIMILAR TO ABOVE) FOR THE COMMANDING OFFICER'S CODE (co_code) # EXECUTIVE OFFICER'S CODE (xo_code) & CHIEF ENGINEER'S CODE (ce_code) # Write your code here ################################################################################################## # Consider the following print statements. Could they be combined into a single print # statement and get the same result? (Answer: Yes) There are many ways to resolve # issues in scripting. You get to decide what works best for your script. # Display Self Destruct Warning print ("--------------------- WARNING! ----------------------") print ("You have initiated the USR ARES Self Destruct Program") print ("_____________________________________________________") print ("You must provide Authorized Initiate Code to Proceed.") ################################################################################################## # Request Authorized Rank # 4. EXPLAIN THE SIGNIFICANCE OF THE int() FUNCTION IN THE FOLLOWING LINE: rank = int(input("Select Correct Rank:\n [1] Commanding Officer\n [2] Executive Officer\n [3] Chief Engineer\n RANK: ")) # A. ################################################################################################## # Because we're expecting the user to enter a number above, the conditional statement # below is needed to convert those numbers into something more useful. Doing this helps # reduce the risk of the user introducing bad data into the script. ################################################################################################## # Retrieve Rank Initiate Code ################################################################################################## # Commanding Officer if rank == 1: code = "111A-Destruct" print ("Commanding Officer Confirmed.") # Executive Officer elif rank == 2: code = "21A2B-Destruct" print ("Executive Officer Confirmed.") # Chief Engineer elif rank == 3: code = "31B2B-Destruct" print ("Chief Engineer Confirmed.") else: print ("You are not authorized to initial Self Destruct.") ################################################################################################## # Enter Self Destruct Code: 000-Destruct-0 or 000-Destruct-1 ################################################################################################## # Set Supplied Rank Code initiate = input("Enter Self Destruct Confirmation Code: ") # Compare Rank Codes if initiate == code: print ("Self Destruct Initiate Code: ACCEPTED") final_code = input("Enter Activation Code: ") if final_code == authorized_final: print ("Destruct Sequence Confirmed.") # 5. EXPLAIN THE SIGNIFICANCE OF X print (x, " seconds to Self Destruct.") # A. print ("ALL HANDS ABANDON SHIP - THIS IS NOT A DRILL") countdown(x) print ("Have a nice day!") print ("BOOM!") elif final_code == authorized_test: print ("Destruct Sequence Test Order Confirmed.") print ("THIS IS A DRILL - THIS IS A DRILL") print ("Timer Set to: " + x + " seconds.") else: print ("Destruct Sequence Aborted.") ################################################################################################## # Program Ends ################################################################################################## # Self Destruct timer = int(input("Enter Countdown Length (in seconds): ")) self_destruct(timer) # 6. LIST THE LOCAL VARIABLES AND GLOBAL VARIABLES USED THROUGHOUT THIS SCRIPT # A. # 7. LIST THE BUILT IN FUNCTIONS USED THROUGHOUT THIS SCRIPT # A. # 8. LIST THE MODULE FUNCTIONS USED THROUGHOUT THIS SCRIPT # A. # 9. LIST THE CUSTOM FUNCTIONS USED THROUGHOUT THIS SCRIPT # A.
Answered 5 days AfterOct 11, 2021

Answer To: As a Support Technician aboard the United Solar Republic Battle Cruiser Ares , you are tasked with...

Sathishkumar answered on Oct 16 2021
133 Votes
#**********************Change 1*********************************************************
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 13:00:30 2021
@author: Tony Jones-Organ
Ent
er Countdown Length (in seconds) and Officer rank.
Commanding :
Officer Initiate Code:111A-Destruct
Executive Officer Initiate Code:21A2B-Destruct
Chief of Engineering Initiate Code:31B2B-Destruct
Self Destruct Confirmation Code
000-Destruct-0
000-Destruct-1
"""
###################################################################################################
import time
# Custom Functions
# 2. DESCRIBE HOW THE INCLUDED countdown() FUNCTION WORKS
# A:Countdown function works like a stopwatch. Countdown receives integer n(seconds) and it subrated by by ubtill the n is zero
# A:It is used for Timer Purpose
def countdown(n):
while n >= 0:
print (n)
time.sleep(1)
n -= 1

##################################################################################################
# Self Destruct Sequencer
# This is the custom function created to handle all of the Self Destruct
# features needed. There are a few steps involved in the process, so take a few
# moments to study how this function works and think about ways to make it better.
def self_destruct(x):
# Set Destruct Codes
authorized_test = "000-Destruct-0"
authorized_final = "000-Destruct-1"
# 3. CREATE VARIABLES (SIMILAR TO ABOVE) FOR THE COMMANDING OFFICER'S CODE (co_code)
# EXECUTIVE OFFICER'S CODE (xo_code) & CHIEF ENGINEER'S CODE (ce_code)
# Write your code here
co_code="11AB-Destruct"
xo_code="21AB-Destruct"
ce_code="31AB-Destruct"

##################################################################################################
#...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here