PYTHON Pls Pls Pls make sure that you read all info below. Thank you. I asked sa
ID: 661714 • Letter: P
Question
PYTHON
Pls Pls Pls make sure that you read all info below. Thank you.
I asked same question twice, but did not get correct answer.
1. You could not import any module
2. You answer need to pass all Example below(1~4)
3. If you answer can pass the tester: Although I could not offer more chegg points for this question (Since Chegg update their system during the time), I will creat more blank question for you (Give you more Chegg points).
PYTHON
Please use python!
Creat a program called difference.py that asks the user for two files and displays the differences between the characters in each file.
1. Your program should ask the user for the path to two different files.
2. For every character that is in the same position in each file but is different between the two files your program should display the index of those characters (starting from 0) as well as the value of those two characters.
3. If one file is longer than the other one, your program should report the index of each of the characters as well as the fact that it could not find a matching character
Examples:
Assume exl.txt contains the contents: "batman" and ex2.txt contains the contents "bitman" and ex3.txt contains the contents "backmans". Enter the name of the first file: exl.txt Enter the name of the second file: ex2.txt Mismatch at character 1 a != I Enter the name of the first file: ex2.txt Enter the name of the second file: exl.txt Mismatch at character 1 i != a Enter the name of the first file: exl.txt Enter the name of the second file: ex3.txt Mismatch at character 2 t != c Mismatch at character 3 m !=k Mismatch at character 4 a !=m Mismatch at character 5 n != a Mismatch at character 6 != n No matching character for character 7 (s) found in ex3.txt. No matching character for character 8 () found in ex3.txt. Enter the name of the first file: ex3.txt Enter the name of the second file: exl.txt Mismatch at character 1 i != a Enter the name of the first file: ex3.txt Enter the name of the second file: ex1.txt Mismatch at character 2 c != t Mismatch at character 3 k !=m Mismatch at character 4 m !=m Mismatch at character 5 a != n Mismatch at character 6 != n No matching character for character 7 (s) found in ex3.txt. No matching character for character 8 () found in ex3.txt.Explanation / Answer
Python Program:
#getting the first filename from the user
Filename1=raw_input(
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.