Question: Use Python: ---------------------------- def roundRobin(filename): # ADD YOUR CODE HERE return # CHANGE OR REPLACE THIS LINE if __name__ == __main__ : source = input(
Use Python:

----------------------------
def roundRobin(filename): # ADD YOUR CODE HERE return # CHANGE OR REPLACE THIS LINE if __name__ == "__main__":
source = input("Enter the name of the round-robin data file: ") print("roundRobin("+source+") yields:") roundRobin(source) print() Complete the roundRobin function, which takes a string argument corresponding to the name of a data file containing a large number of integers in the range 1 through 10 (inclusive). This function counts the frequency of each value in the data file (for example, how many 4s are in the data), and then prints the contents of the data file in the following way: for each possible data value, if its frequency is at least 1, then the value is printed (once) followed by a space and its frequency is decremented by 1.After each possible value (1-10) has been considered, a newline is printed and the process repeats with the remaining values until all of the frequency counts have been reduced to 0. Put another way, suppose that there are three 1s, four 2s, and one 3. The first round of printing would print 1, 2, and 3 (one copy each) and decrement each of their frequency values by 1. The second round of printing would print 1 and 2, but not 3 (we already printed the only 3 in the first line), and update their frequency values again. This continues for another line, after which 1 has been exhausted. The final line of output only prints 2, since that's the only number remaining with a frequency greater than 0. As a second example, consider a data file with the following contents 6 3 3 5 5 2 6 3 56 4 4 2 5 3 4 1 5 5 2 4 5 1 6 6 3 2 6 1 4 1 5 1 5 5 This data would be printed as follows: 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 3 4 5 6 56 You will need a nested loop (a for loop inside a while loop) to solve the printing part of this problem. Hint: To dramatically simplify things, count the total number of values as you read them from the text file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
