Write a program that asks the user for the name of a text file. The program should display the last 10 lines of the file on the screen (the “tail” of the file). If the file has less than 10 lines, the entire file is displayed, with a message that the entire file has been displayed. The program should do this by seeking to the end of the file and then backing up to the tenth line from the end.
Q: 1. Write a program in python with no imports named filemaker.py that will be used to store the first…
A: The name of the program is filereader.pyOpen the file named friends.txtUse a variable named…
Q: Write a program that asks the user for the name of a file and a string to search for. The program…
A: Program Approach - Use the essential header files as per code requirements. Define the function…
Q: The program will prompt the user to enter the file names for a source input file and an output file…
A: #Get input file name fileOne = input("Enter the input file name :") #Get output file name fileTwo =…
Q: 5. Write a program that checks whether a sequence of HTML tags is properly nested. For each opening…
A: using linked list Linked list is a linear data structure in which elements are not stored at…
Q: Write a program that reads a list of names from a data file and displays the names to the console.…
A: 1. #include <iostream>#include <fstream>#include <string>using namespace std;int…
Q: Write a program in python with no imports named filemaker.py that will be used to store the first…
A: Note: As per our honour code, we’ll answer the first question since the exact one wasn’t specified.…
Q: Write a program that opens an output file with the filename bl_address.txt, writes your adress to…
A: Since the Programming language is not mentioned in the question, we will answer this question in C++…
Q: Write a program that reads every line in a text file, removes the first wordfrom each line, and then…
A: Given: Write a program that reads every line in a text file, removes the first wordfrom each line,…
Q: Write a program that writes 100 integers created randomly into a file. Integers are separated by a…
A: import randomfilename = input("Input the Filename: ")if os.path.isfile("C:/Users/Documents/" +…
Q: Write a program to read two file names from the command line. If the number of arguments in the…
A: When we passed arguments to the main function is called Command-Line arguments. The command-line…
Q: Write a function that reads a text files and writes the same file out but with the lines double…
A:
Q: Write a program that takes two command line arguments (realized as sys.argv[1] and sys.argv[2]). The…
A: import sysimport csv ip=sys.argv[1]op=sys.argv[2] #taking the answers from 3 users 3 timesfor i in…
Q: Exercise # 1 Write a program that reads a file containing text. Read each line and send it to the…
A: The answer is in next step:-
Q: Write a program that enters data of 10 bank accounts and write on a file Account.txt file. Account…
A: CODE : #include<stdio.h> #include<string.h> //Structure for Bank Account struct…
Q: Write a program to read two file names from the command line. If the number of arguments in the…
A: Note: - Since the programming language is not mentioned so I am writing this program in C++. Below…
Q: Write a program that reads a file “source.txt” and copies it’s all contents to another file…
A: #include <iostream>#include <fstream>using namespace std; bool is_vowel(char &ch) {…
Q: Write a program that asks the user for the name of a file, and an integer number. The program should…
A: #include <iostream>#include <sstream>#include <fstream>using namespace std;int…
Q: Write a program that removes all the occurrences of a specified string from a text file.Removes the…
A: let us see the code you haven't specified the language so I have written this code in C++
Q: in.txt and the output file is called out.txt. Two files should be exactly the same after copying
A: Here below is the code for copies the file form input to output. Input taken: c functions : fgetc(),…
Q: Suppose you are given a text file "students.txt" that contains the data of students. Every line in…
A: the code is an given below : CODE- import java.io.File;import java.io.FileNotFoundException;import…
Q: Write a program that makes a copy of the file. Your program will ask the user for the source file…
A: Hi. As you have not mentioned any programming language, I will choose Python. Let's move on to…
Q: Write a CPP program to do the following: Read the attached text file "DISTRICT-COSC-1437.txt".…
A: Required: Write a CPP program to do the following: Read the attached text file…
Q: Write a program that reads a file of numbers of type int and writes all the numbers to another file,…
A: #include <iostream>#include <iomanip> // re. setw#include <fstream> using…
Q: m that reads real numbers from a data file named "numbers.txt", one-by-one. For each number, the…
A: numbers.txt 1.5 6.2 96.3-6-399.6 3.2 3.6
Q: Write a program that asks the user for the name of a text file. The program should display the first…
A: Given: Write a program that asks the user for the name of a text file. The program should display the…
Q: Write a program that allows the user to navigate the lines of text in a file. The program should…
A: Program enterfile = input("Enter the file name: ") file = open(enterfile, 'r') linecount = 0 for…
Q: Write a program that gets 2 or more command-line arguments. The last argument is a file that the…
A: Code: lis=list(input("Enter filenams: ").split())p=lis[-1]+".txt"file1 = open(p,"w") for i in…
Q: Write a program that asks the user for the name of a file. The program should display only the first…
A: Program Plan: Create the file variable and prompt the user to input the name of file to be read…
Q: Write a program that uses an existing text file (text.txt) to determine the number of occurrences of…
A: Here is the detailed explanation of the program
Q: 2. Keep only the last three lines of a file and delete others. If there are less than three lines in…
A: Answer
Q: Create a program that reads the text file called "data.txt". Column O contains the patient number…
A: NumPy is the python built-in package that has the functions to create an array and multidimensional…
Q: Write a program that reads two input files whose lines are ordered by a key data field. Your program…
A: required: Write a program that reads two input files whose lines are ordered by a key data field.…
Q: Write a program to read all the values in the attached file test_scores.csv, calculate the total of…
A: Here I have opened the CSV file in read mode. Next, I have used the reader() method from the CSV…
Q: Write a program in python with no imports named filemaker.py that will be used to store the first…
A: Create a file named filemaker.pyPrompt user for name of a friend and his age repeatedly until user…
Q: Suppose you are given a text file "students.txt" that contains the data of students. Every line in…
A: code is an given below : import java.io.*; import java.util.*; public class Main {…
Q: Write a program that asks the user to enter her name, age, favorite color, and favorite food. Have…
A: Python used to answer this question
Q: Write a program that uses an initially empty file to store a sorted list of integers entered by the…
A: Solution : As there is not mentioned which programming language needed .. so I am doing this…
Q: Write a program to compare two files, printing the first line where they differ.
A: C program to compare two files and report differ We've been given virtually identical files.…
Q: Write a program that writes a series of random numbers to a file. Each random number should be in…
A: Introduction Random numbers are those which are generated randomly within some range. random module…
Q: Write a program that asks the user to input one number at a time and then the program should add the…
A: Algorithm: Get the vary from the user.declare two arrays one for number and the other for addget the…
Q: Write a script named numberlines.py. This script creates a program listing from a source program.…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.…
Q: Write a program that reads a text file which has a poem written in it. (Write down the poem yourself…
A: I have taken the poem called "THE LESSON" by Roger McGough.
Q: 2. Create a program that writes an Integer object to a stream and reads this object from the stream.…
A: Note: Answering the first question as per the guidelines and in java as no language is not…
Q: Question 3: Write a program that reads a file of text and displays the number of words in that file.…
A: please upvote for my efforts thanks! answer: code #include <bits/stdc++.h>using…
Q: Write a program that asks the user for the name of a file, and an integer number. The program should…
A: #include <iostream>#include <sstream>#include <fstream>using namespace std;int…
Q: Write a program that creates the following three files; dataplus.txt dataminus.txt zeros.txt
A: See the solution below.
Write a program that asks the user for the name of a text file. The program should display the last 10 lines of the file on the screen (the “tail” of the file). If the file has less than 10 lines, the entire file is displayed, with a message that the entire file has been displayed. The program should do this by seeking to the end of the file and then backing up to the tenth line from the end.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Write a program that prompts the user to enter apoint (x, y) and checks whether the point is within the rectangle centred at (1, 1)with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4)is outside the rectangle, as shown in Figure . (Hint: A point is in the rectangleif its horizontal distance to (0, 0) is less than or equal to 10 / 2 and its verticaldistance to (0, 0) is less than or equal to 5.0 / 2. Test your program to cover allcases.) Here are two sample runs. Enter a point with two coordinates: 2 2 ↵EnterPoint (2.0, 2.0) is in the rectangleWrite a program that displays twocircles with radius 10 at location (40, 40) and (120, 150) with a line connectingthe two circles, as shown in Figure . The distance between the circlesis displayed along the line. The user can drag a circle. When that happens, thecircle and its line are moved, and the distance between the circles is updated.Write a program for an airline company. that asks the user about his luggage weight. * if the luggage weight is higher than 50, it shows a warning message that he will be paying an extra 25$ for his luggage. * At the end, it always thanks the user for his business.
- Write a program that coverts a zip code to a bar code. The bar codes use large and small bars. We will use : as a small bar and | as a large bar. Each digit has its own bar pattern. 1 is :::|| 2 is ::|:| 3 is ::||: 4 is :|::| 5 is :|:|: 6 is :||:: 7 is |:::| 8 is |::|: 9 is |:|:: 0 is ||::: The barcode also includes a check digit. The final digit added to the bar code verifies the previous numbers are correct. To Determine the checksum: Add all the digits together Determine what needs to be added to make the total a multiple of 10 The bar code also always starts and ends with a large bar. This is used by the scanner to align the letter. Drexel's Zip Code is 19104 The check digit is 5. The sum of the digits is 1+9+1+0+4 = 15. To make 15 a multiple of 10, we need to add 5. The bar code will be |:::|||:|:::::||||::::|::|:|:|:| The majority of work in this problem is done by digit. It makes sense to store the zip code as a string, not as an integer. Write the function checksum(zip)…Write a program that coverts a zip code to a bar code. The bar codes use large and small bars. We will use : as a small bar and | as a large bar. Each digit has its own bar pattern. 1 is :::|| 2 is ::|:| 3 is ::||: 4 is :|::| 5 is :|:|: 6 is :||:: 7 is |:::| 8 is |::|: 9 is |:|:: 0 is ||::: The barcode also includes a check digit. The final digit added to the bar code verifies the previous numbers are correct. To Determine the checksum: Add all the digits together Determine what needs to be added to make the total a multiple of 10 The bar code also always starts and ends with a large bar. This is used by the scanner to align the letter. Drexel's Zip Code is 19104 The check digit is 5. The sum of the digits is 1+9+1+0+4 = 15. To make 15 a multiple of 10, we need to add 5. The bar code will be |:::|||:|:::::||||::::|::|:|:|:| The majority of work in this problem is done by digit. It makes sense to store the zip code as a string, not as an integer. Write the function checksum(zip)…Write a program that can be used by MG-Train to purchase tickets. The train has three cars. Car #1 has 10 seats (rows: 1 – 5, columns: A and D), Car #2 has 20 seats (rows: 1 – 5, columns: A, C, and D), and Car #3 has 20 seats (rows: 1 – 5, columns: A, B, C, and D). Each car has different seat price (Car #1: $300, Car #2: $200, and Car #3: $100). The program should display a screen that shows which seats are available and which are taken. For example, the following screen shows a chart depicting each seat in the train. Seats that are taken are represented by an symbol, and seats that are available are represented by a symbol
- Write a program that will send notification to Warehouse Manger when the inventory of an item become less than 2. If the quantity of the item is greater than 2 then it will display a message of "It's sufficient! Number of items is ", if not, it will send a notification "Need to purchase , quantity is low!". Sample 1: Enter the product name: Mechanical Pen Number of items in inventory: 2 Notification: Need to purchase " Mechanical pen", quantity is low!Write a program that prompts the user to enter a sequence of numbers until a -999 is entered. It will print the numbers the user entered, five number in a row,with a before the first number and after the last number in each row. For example, Enter a number (-999 to stop): 23Enter a number (-999 to stop): 15Enter a number (-999 to stop): 1Enter a number (-999 to stop): 7Enter a number (-999 to stop): 9Enter a number (-999 to stop): 21Enter a number (-999 to stop): 17Enter a number (-999 to stop): 33Enter a number (-999 to stop): -999[23 15.17 9] [21 17 33]Write a program that asks the user to enter a 1st color choice from a set of options: red, yellow or blue, and then asks them to enter a 2nd color choice from the remaining 2
- Write a program that reads the user's first name and last name, and then use them to create a UPM email for the user. If the total number of characters in the user's full name, (first name + last name), is less than 10 letters, you should use the full name to create the user’s email. The general format of the user’s email should look like this: firstName.lastName@upm.edu.sa For example: First name = Ali Last name = Omar Total number of letters in both first and last names = 7 letters (<10 letters) Output = omar.ali@upm.edu.sa If the number of characters in the user's full name, (first name + last name), is greater than or equal to 10 letters, you should only use the first character in the user’s first name, and the whole last name to create an email. For example: First name = Abdullah Last name = Omar Total number of letters in both first and last names = 12 letters (>=10 letters) Output = a.omar@upm.edu.sa Note: you can assume the user will always enter lowercase lettersWrite a program that prompts the user to enter thecenter x-, y-coordinates, width, and height of two rectangles and determineswhether the second rectangle is inside the first or overlaps with the first, as shownin Figure . Test your program to cover all cases.Write a program that can suggest an activity based on the temperature. If the temperature is between 20 to 40 degrees Fahrenheit, suggest the user go skiing; if the temperature is between 41 to 60 degrees Fahrenheit, suggest the user go hiking; if the temperature is in the range of 61 to 80, suggest swimming. For all the temperatures out of these ranges (too cold or too hot), then suggest staying inside.