PYTHON
Generates a list of datetimes given a list of dates and a list of times. All possible combinations of date and time are contained within the result. The result is sorted in chronological order.
For example,
Input:
>>> timetable([date(2019,9,27), date(2019,9,30)],
[time(14,10), time(10,30)])
Output:
[datetime(2019,9,27,10,30), datetime(2019,9,27,14,10),
datetime(2019,9,30,10,30), datetime(2019,9,30,14,10)]
Hi, here is the code. try it and let me know if you need any modifications
from datetime import date, time, datetime def timetable(date_list: [], time_list: []): datetime_list = [] for d in date_list: for t in time_list: datetime_list.append(datetime(d.year, d.month, d.day, t.hour, t.minute, t.second)) datetime_list.sort() return datetime_list
PYTHON Generates a list of datetimes given a list of dates and a list of times....
Python program
- Write a Python program, in a file called sortList.py, which, given a list of names, sorts the names into alphabetical order. Use a one dimensional array to hold the list of names. To do the sorting use a simple sorting algorithm that repeatedly takes an element from the unsorted list and puts it in alphabetical order within the same list. Initially the entire list is unsorted. As each element is placed in alphabetical order, the elements in...
python code The power set of a list L is a list containing all possible combinations of the elements of L. For example, the power set of [1, 2, 3] is [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]. Section 9.3 of your textbook describes a (subtle) algorithm for generating the power set. • Read and understand the structure of the code in Figure 9.6 • Write (your own) function powerset(L) that generates and returns...
1. Five jobs are waiting to be processed. Their processing times and due dates are given below. Using the longest processing time dispatching rule, in which order should the jobs be processed? All dates are specified as days from today. Job Processing Time (days) 4 Job due date (days) 7 A B 7 4 11 с 3 D 8 5 E 5 8 A) D, B, E, A, C B) C, A, E, B, D C) B, D, E, A,C...
Please show public static void main(String args[]){} also too! 8. Given a non-empty list of dates, this method groups them based on the day of the wel on which they occurred; selects the earliest one in each group; and return the selected ones. The return is a map whose keys are the short day-of-the-week names and whose values are the selected dates. The map is sorted on its keys: public static Map latestByWeekday(List list) Example, if list is: CThu Mar...
IN PYTHON Develop the program that will allow you to obtain an ordered list of whole numbers from least to greatest from two lists of whole numbers. The individual values of the input lists are captured by the user one by one and then both lists will be joined and then sorted in ascending order (from lowest to highest value). Your program should allow the capture of the entire values of the lists without making use of messages (legends) to...
PYTHON: 14.7 LAB: All permutations of names PLEASE ANSWER IN PYTHON Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names, then use a recursive method to create and output all possible orderings of those names, one ordering per line. NAES MUST BE ALPHABETICAL ORDER AS IN THE EXAMPLE When the input is: Julia Lucas Mia then the output...
Five jobs are waiting to be processed. Their processing times and due dates are given below. Using the shortest processing time dispatching rule, in which order should the jobs be processed? Processing Time (days) Job due date (days) Job A B 4 C 11 D 8 5 8 O A. D, A, E, B, C О в. D. В. Е. А. С О С. С. А, Е, в.р O D. C, E, A, B, D O E. B, D, A,...
IN PYTHON Write a program that, given a set of words in a list, calculate how many words begin with the letter you capture. Entry: 5 words and 1 letter Output: # of words that have the letter. IMPORTANT NOTE: Your program should not include an input message: you are only going to capture the 5 words and finally the letter you want to find and as an output message you must indicate only the number of words that begin...
For Python [25 pts] Write the method divisorList(aList, divisor) that takes in a list with elements of any data type and a divisor which is in the form of an integer. The output is a sorted list of only the integers that are divisible by the divisor. Example: divisorList([1, 1, 12, 'a', 90, 34], 2) will return [12, 34, 90] since 12, 90, and 34 are all divisible by two. Note that the returned list is sorted from smallest to...
I want this using while loop
This using stringin python
Use list or some thing in python
Using list in python
I want answer as soon as posdible
E. Last Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard output You are given a sequence of positive integers aj, , 03, ... Print the last element of the sequence. Input The input consists of multiple lines. The i-th line contains a...