Question 5: Complete the below function that takes the name of two files, inFilename and outFilename as arguments and reads the text from the inFilename. In this file each line contains the Turkish Republic Identity Number (TCNO), name, surname and telephone number of a person. Your function should sort all persons according to their TCNO, write the sorted data into outFilename. If the file inFilename does not exist, then the function must create an empty file named outFilename. For example, if the function is called such as readText("in.txt", "out.txt") and in.txt is as follows: ===== in.txt ===== 12345678904 Barış Manço 0555-999-99-66 12345678902 Ahmet Kaya 0555-999-99-88 12345678901 Burkay Genç 0555-999-99-99 12345678903 Erkin Koray 0555-999-99-77 ================== Then, the function writes the sorted information into "out.txt" as follows: ===== out.txt ===== 12345678901 Burkay Genç 0555-999-99-99 12345678902 Ahmet Kaya 0555-999-99-88 12345678903 Erkin Koray 0555-999-99-77 12345678904 Barış Manço 0555-999-99-66 ================== You can assume that TCNO and the phone number will be provided as a block, without any spaces. You can also assume that the persons have just one name. Note that inFilename and outFilename are the names of arguments of the function. They are strings, and the values of the strings are the actual file names. For example, if the function is called such as: readText("file1.txt", "file2.txt") then, you must read the content from "file1.txt" and write the output to "file2.txt". """ def readText(inFilename,outFilename):
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here