Write a Pyhton program to copy one file to another. Prompt the user to enter the
ID: 3910108 • Letter: W
Question
Write a Pyhton program to copy one file to another. Prompt the user to enter the name of a source file and the name of a destination file. Then copy the source file to a file created with the destination file name.
get this error & cant figure were I'm going wrong! Python Code
def main(): get_src) get destination () copy ) def get_src): def get_destination): def copy ) source file- input("Enter input file name: ") destination fileinput ("Enter output file name:") with open (source_file) as c: with open (destination file, "v) as ci: Ior line in C: c1.write (line) main()Explanation / Answer
def main(): src = get_src() dest = get_destination() copy(src,dest) def get_src(): file = input("Enter input file name") return file def get_destination(): file = input("Enter output file name") return file def copy(source_file, destination_file): c = open(source_file) c1 = open(destination_file) for line in c: c1.write(line) main()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.