Question

reverse file Writ te a function named reverse file. This function will take one parameter which will be the file name of the file to reverse. This function will open the file with the name passed in as a parameter and will print out all the lines of the file in reverse order. Below are a few examples: If the files lines.brt looks like: orange apple orange apple orange apple grape Then the following should look like >> reverse_file(lines.txt) grape appie orange apple orange apple orange

using Python please

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
using Python please reverse file Writ te a function named reverse file. This function will take...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python 3 HW11.2. Read a file and print its lines The function takes a single string...

    python 3 HW11.2. Read a file and print its lines The function takes a single string parameter, which is the name of a file. Complete the function to open the file for reading, read the lines of the file, and print out each line. The function takes a single string parameter, which function to open the file for reading, read the lines student.py def print_lines of file (filename): 1

  • Python Please, If possible, please continue with/ use code already given File Commands: u/a Write a...

    Python Please, If possible, please continue with/ use code already given File Commands: u/a Write a function named, file_commands, that takes the name of a file as a parameter. The function processes the contents the file as follows: For file lines that begin with the letter 'a', calculate & print the integer average of the numbers on the line. For file lines that begin with the letter 'u', print the upper case format for each word following the u. Sample...

  • In python Attached is a file called sequences.txt, it contains 3 sequences (one sequence per line)....

    In python Attached is a file called sequences.txt, it contains 3 sequences (one sequence per line). Also attached is a file called AccessionNumbers.txt. Write a program that reads in those files and produces 3 separate FATSA files. Each accession number in the AccessionNumbers.txt file corresponds to a sequence in the sequences.txt file. Remember a FASTA formatted sequence looks like this: >ABCD1234 ATGCTTTACGTCTACTGTCGTATGCTTTACGTCTACTGACTGTCGTATGCTTACGTCTACTGTCG The file name should match the accession numbers, so for 1st one it should be called ABCD1234.txt. Note:...

  • Python Chet is trying to create a tail program for his windows machine so he can...

    Python Chet is trying to create a tail program for his windows machine so he can see the last N lines of a file or list of files. He wants the program to be usable by his friends and family so when an argument does not get passed to the program it should display a usage message. This is shown by the parser object by default but it's not doing it for him. The code works just not this one...

  • Using python Question 13 (20 points) Write a function named Linestats that finds the number of...

    Using python Question 13 (20 points) Write a function named Linestats that finds the number of consonant and vowel letters on each line of a file and writes those statistics to a corresponding line of a new file, separated by a space. Definitions: A vowel letter is one of a, e, i, o, u, along with the corresponding uppercase letters..A consonant letter is not a vowel letter. The function linestats takes two parameters: 1. inFile, a string, the name of...

  • Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this...

    Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this file, include your assignment documentation code block. After the documentation block, you will need several import statements. import java.util.Scanner; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; Next, declare the Lab12 class and define the main function. public class Lab12 { public static void main (String [] args) { Step 2: Declaring Variables For this section of the lab, you will need to declare...

  • Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a...

    Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a source program. This script should: Prompt the user for the names of two files. The input filename could be the name of the script itself, but be careful to use a different output filename! The script copies the lines of text from the input file to the output file, numbering each line as it goes. The line numbers should be right-justified in 4 columns,...

  • A. File I/O using C library functions File I/O in C is achieved using a file...

    A. File I/O using C library functions File I/O in C is achieved using a file pointer to access or modify files. Processing files in C is a four-step process: o Declare a file pointer. o Open the desired file using the pointer. o Read from or write to the file and finally, o Close the file. FILE is a structure defined in <stdio.h>. Files can be opened using the fopen() function. This function takes two arguments, the filename and...

  • Write a class named SatData that reads a JSON file containing data on 2010 SAT results...

    Write a class named SatData that reads a JSON file containing data on 2010 SAT results for New York City and writes the data to a text file in CSV (comma-separated values) format. It just needs to read a local JSON file - it doesn't need to access the internet. Specifically, your class should have an init method that reads the file, and it should have a method named save_as_csv that takes as a parameter a list of DBNs (district...

  • use python IDEL Please highlight the answer Problem 2 Files. Since almost all data can be...

    use python IDEL Please highlight the answer Problem 2 Files. Since almost all data can be stored in files, knowing how to use files in programs is invaluable. Today you will practice with opening a file for reading, writing and editing using the Python interpreter. Do not type messages in red into Python shell Question 14 0.5 pts create a new file mytext.txt for >>>f1 = open("mytest.txt","w+") writing & reading >>>f1.write("hello\n") >>>for i in range(5): f1.write(str(i) + "\n") >>>f1.readlines() record...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT