Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having trouble with the createList section of this assignment any tips or e

ID: 3916853 • Letter: I

Question

I am having trouble with the createList section of this assignment any tips or explanations will be very much appreciated.

Write a Python program that computes the cost of a long-distance call.  

The cost of the call is determined according to the following rate schedule:

a. Any call started between 8:00 A.M. and 6:00 P.M., Monday through Friday, is billed at a rate of $0.40 per minute.

b. Any call starting before 8:00 A.M. or after 6:00 P.M., Monday through Friday, is charged at a rate of $0.25 per minute.

c. Any call started on a Saturday or Sunday is charged at a rate of $0.15 per minute.

The input will consist of the day of the week, the time the call started, and the length of the call in minutes. The output will be the cost of the call. The time is to be input in 24-hour notation, so the time 1:30 P.M. is input as (must be the following format, the user types in the colon):
13:30

The day of the week will be read as one of the following pairs of character values, which are stored in two variables of type string (ex. a, b = "Mo"):
Mo Tu We Th Fr Sa Su

Be sure to allow the user to use either uppercase or lowercase letters or a combination of the two. The number of minutes will be input as a value of integer.  

Format your output to two decimal places.

Define the following lists and fill the lists using the two functions (createList() and fillList()):

Calling the functions (copy the following statements into your program):

hoursList = createList(24)
fillList (24, hoursList)
minutesList = createList(60)
fillList (60, minutesList)

hoursList = [0, 1, 2, .........., 22, 23]

minutesList = [0, 1, 2, .........., 58, 59]

Define the following lists and fill the lists manually (copy the following code and paste into your program):


daysList = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']

responseList = ['y', 'n']

Define the following functions:

createList(listSize): accepts a listSize as a argument, create a 1-D list called timeList with the listSize (initial values: zeros), and returns the timeList list.

fillList(listSize, timeList): accepts a listSize and the list returned by createList() as arguments, and fill the passed list. This is a void function.

collectUserInputTime(): accepts no arguments, collects call starting time in 24-hour notation, and returns startHour and startMinute as string data type.

validateUserInputTime(startHour, startMinute): accepts the startHour and startMinute returned by collectUserInputTime() as arguments, validates the user's time input by comparing to the lists called hoursList and minutesList, and returns True, startHour (integer), startMinute (integer) if the input is valid, or False if the input is invalid.

Explanation / Answer

As you only asked for help for createlist , here is the code for that. for any query leave comment and don't forget to give thumbs up, thanks

CODE :

def createList(listSize):
timeList=[0]*listSize;
return timeList;

def fillList(value,L):
for i in range(value):
L[i]=i;