please create a simple python script for this exercise with an explanation of how it works. I have attached my starter code and desired outcome in the images. my starter # Program to simulate a speed dialer # Complete the four functions listed below that work with # two global lists that manage a dialer with 5 fixed slots. # Initialize the dialer with empty data. dialerNames = ["Empty", "Empty", "Empty", "Empty", "Empty"] dialerNumbers = ["Empty", "Empty", "Empty","Empty", "Empty"] #function to show the current dialer data def printList(): for i in range(len(dialerNames)): print((i + 1),dialerNames[i],dialerNumbers[i], sep="\t") #Function to handle dial by slot number command which # prompts the user for the slot number # validates the slot number # if not within valid range (1 through 5), prints "Invalid slot number" # if user enters non-integer input, prints "Please enter integer" using # try/except code block. # else checks if the slot at given slot number is empty, if so prints "Slot empty" # else prints "Calling name ........xxx-xxx-xxxx" # E.g. If user enters 3 and slot number 3 (values at index 2 in above lists) had # name = "Susan" and number 4255551212, this function will print # "Dialing Susan ........425-555-1212" def dialBySlot(): #Implement this function pass #Function to handle update by slot number command which # prompts the user for the slot number to be updated # if not within valid range, prints "Invalid slot number" # if user enters non-integer input, prints "Please enter integer" # using try/except code block. # else # prompts the user for the new name and new number # and updates entries for the slot number. # prints "Updated slot number X" where X is the slot number user entered. def updateSlot(): #Implement this function pass #Function to handle dial by name command which # prompts the user for the name # checks if the name is present in dialerNames list (make the comparison # case-insensitive) # if not present prints "Name not found." # else prints "Calling name ....xxx-xxx-xxxx" # E.g. If user enters "Susan" and slot number 3 (values at index 2 # in above lists) had name = "Susan" and number 4255551212, # dialByName() will print # "Dialing Susan ........425-555-1212" def dialByName(): #Implement this function pass def main(): print('''Welcome to the Speed Dialer. Commands: p for print \tn dial by name u for update\ts dial by slot e for exit''') command = input('''Please enter command(p/n/s/u/e): ''').lower() while (not command.startswith('e')): if (command.startswith('p')): printList() elif (command.startswith('n')): dialByName() elif (command.startswith('s')): dialBySlot() elif (command.startswith('u')): updateSlot() command = input("Please enter command(p/n/s/u/e): ").lower() print("Goodbye!") if __name__ == "__main__": main() You will complete a program that keeps track of a phone speed dialer directory which has 5 fixed slots. Your program will allow the user to see all the entries of the directory, and allow to dial and update an entry at a slot number.  The 3 functions listed below and make sure the program runs as shown in the sample runs. Note that the functions are expected to work on the global lists, no need to pass them as arguments. dialBySlot: Function to handle dial by slot number command which prompts the user for the slot number and validates the slot number. If not within valid range (1 through 5), prints "Invalid slot number". If user enters non-integer input, prints "Please enter integer" using try/except code block. Otherwise checks if the slot at the given slot number is empty, if so prints "Slot empty" else prints "Calling name ........xxx-xxx-xxxx" E.g. If user enters 3 and slot number 3 (values at index 2 in above lists) had name = "Susan" and number 4255551212, this function will print "Dialing Susan .......425-555-1212". updateBySlot: Function to handle update by slot number command which prompts the user for the slot number to be updated. It next validates the slot number, if not within valid range, prints "Invalid slot number". If user enters non-integer input, prints "Please enter integer" using try/except code block. If valid, prompts the user for the new name and new number and updates entries in the two global lists for the slot number. It then prints "Updated slot number X" where X is the slot number user entered. dialByName: Function to handle dial by name command which prompts the user for the name. It then checks if the name is present in dialerNames list. (Make the name comparison case-insensitive). If not present, prints "Name not found." If present, prints "Calling name ....xxx-xxx-xxxx" E.g. If user enters "Susan" and slot number 3 (values at index 2 in above lists) had name = "Susan" and number 4255551212, dialByName() will print "Dialing Susan ........425-555-1212"

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please create a simple python script for this exercise with an explanation of how it works. I have attached my starter code and desired outcome in the images.

my starter

# Program to simulate a speed dialer
# Complete the four functions listed below that work with
# two global lists that manage a dialer with 5 fixed slots.
# Initialize the dialer with empty data.
dialerNames = ["Empty", "Empty", "Empty", "Empty", "Empty"]
dialerNumbers = ["Empty", "Empty", "Empty","Empty", "Empty"]

#function to show the current dialer data
def printList():
for i in range(len(dialerNames)):
print((i + 1),dialerNames[i],dialerNumbers[i], sep="\t")

#Function to handle dial by slot number command which
# prompts the user for the slot number
# validates the slot number
# if not within valid range (1 through 5), prints "Invalid slot number"
# if user enters non-integer input, prints "Please enter integer" using
# try/except code block.
# else checks if the slot at given slot number is empty, if so prints "Slot empty"
# else prints "Calling name ........xxx-xxx-xxxx"
# E.g. If user enters 3 and slot number 3 (values at index 2 in above lists) had
# name = "Susan" and number 4255551212, this function will print
# "Dialing Susan ........425-555-1212"
def dialBySlot():
#Implement this function
pass


#Function to handle update by slot number command which
# prompts the user for the slot number to be updated
# if not within valid range, prints "Invalid slot number"
# if user enters non-integer input, prints "Please enter integer"
# using try/except code block.
# else
# prompts the user for the new name and new number
# and updates entries for the slot number.
# prints "Updated slot number X" where X is the slot number user entered.

def updateSlot():
#Implement this function

pass


#Function to handle dial by name command which
# prompts the user for the name
# checks if the name is present in dialerNames list (make the comparison
# case-insensitive)
# if not present prints "Name not found."
# else prints "Calling name ....xxx-xxx-xxxx"
# E.g. If user enters "Susan" and slot number 3 (values at index 2
# in above lists) had name = "Susan" and number 4255551212,
# dialByName() will print
# "Dialing Susan ........425-555-1212"
def dialByName():
#Implement this function
pass

def main():
print('''Welcome to the Speed Dialer.
Commands:
p for print \tn dial by name
u for update\ts dial by slot
e for exit''')
command = input('''Please enter command(p/n/s/u/e): ''').lower()
while (not command.startswith('e')):
if (command.startswith('p')):
printList()
elif (command.startswith('n')):
dialByName()
elif (command.startswith('s')):
dialBySlot()
elif (command.startswith('u')):
updateSlot()
command = input("Please enter command(p/n/s/u/e): ").lower()
print("Goodbye!")

if __name__ == "__main__":
main()

You will complete a program that keeps track of a phone speed dialer directory which has 5 fixed slots. Your program will allow the user to see all the entries of the directory, and allow to dial and update an entry at a slot number.  The 3 functions listed below and make sure the program runs as shown in the sample runs. Note that the functions are expected to work on the global lists, no need to pass them as arguments.

dialBySlot: Function to handle dial by slot number command which prompts the user for the slot number and validates the slot number. If not within valid range (1 through 5), prints "Invalid slot number". If user enters non-integer input, prints "Please enter integer" using try/except code block. Otherwise checks if the slot at the given slot number is empty, if so prints "Slot empty" else prints "Calling name ........xxx-xxx-xxxx"
E.g. If user enters 3 and slot number 3 (values at index 2 in above lists) had name = "Susan" and number 4255551212, this function will print "Dialing Susan .......425-555-1212".
updateBySlot: Function to handle update by slot number command which prompts the user for the slot number to be updated. It next validates the slot number, if not within valid range, prints "Invalid slot number". If user enters non-integer input, prints "Please enter integer" using try/except code block. If valid, prompts the user for the new name and new number and updates entries in the two global lists for the slot number. It then prints "Updated slot number X" where X is the slot number user entered.
dialByName: Function to handle dial by name command which prompts the user for the name. It then checks if the name is present in dialerNames list. (Make the name comparison case-insensitive). If not present, prints "Name not found." If present, prints "Calling name ....xxx-xxx-xxxx"
E.g. If user enters "Susan" and slot number 3 (values at index 2 in above lists) had name = "Susan" and number 4255551212, dialByName() will print
"Dialing Susan ........425-555-1212"

A IDLE Shell 3.92
Eile Edit Shel Debug Qptions Window Help
Latam ut
Welcome to the Speed Dialer.
Commands:
p for print
u for update
e for exit
n dial by name
s dial by slot
Please enter command:P
Empty
Empty
Empty
Empty
Empty
1
Empty
Еmpty
Empty
Empty
Empty
Please enter command (p/n/s/u/e) : s
4
5
Enter the slot number : 1
Slot is empty
Please enter command (p/n/s/u/e) : u
Enter the slot number: 6
Invalid slot number.
Please enter command (p/n/s/u/e) : u
Enter the slot number: two
Please enter an integer.
Please enter command (p/n/s/u/e) : u
Enter the slot number: 2
Enter new name: Molly
Enter new number: 4255551212
Updated slot number 2
Please enter command (p/n/s/u/e) : P
Empty
4255551212
Empty
Molly
Empty
Empty
Empty
2
3
Empty
Empty
Empty
Please enter command (p/n/s/u/e) : s
Enter the slot number : 2
Calling Molly........425-555-1212
Please enter command (p/n/s/u/e) : e
4
Goodbye!
>>>
Ln: 41 Col: 4
Transcribed Image Text:A IDLE Shell 3.92 Eile Edit Shel Debug Qptions Window Help Latam ut Welcome to the Speed Dialer. Commands: p for print u for update e for exit n dial by name s dial by slot Please enter command:P Empty Empty Empty Empty Empty 1 Empty Еmpty Empty Empty Empty Please enter command (p/n/s/u/e) : s 4 5 Enter the slot number : 1 Slot is empty Please enter command (p/n/s/u/e) : u Enter the slot number: 6 Invalid slot number. Please enter command (p/n/s/u/e) : u Enter the slot number: two Please enter an integer. Please enter command (p/n/s/u/e) : u Enter the slot number: 2 Enter new name: Molly Enter new number: 4255551212 Updated slot number 2 Please enter command (p/n/s/u/e) : P Empty 4255551212 Empty Molly Empty Empty Empty 2 3 Empty Empty Empty Please enter command (p/n/s/u/e) : s Enter the slot number : 2 Calling Molly........425-555-1212 Please enter command (p/n/s/u/e) : e 4 Goodbye! >>> Ln: 41 Col: 4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY