Write an application that allows a user to enter a filename and an integer representing a file position. Assume that the file is in the same folder as your executing program. Access the requested position within the file, and display the next 10 characters there.

Answers

Answer 1

The program is an illustration of file manipulations, where files are accessed, read and modified

The main program

The program written in Python, where comments are used to explain each action is as follows;

#This gets the file name

fname = input("Enter file name: ")

#This gets an integer value

num = int(input("Integer: "))

#This opens the file

file = open(fname, 'r')

#This initializes the number of characters to 0

count = 0

#This begins an iteration

while 1:

# This prints each character

print(file.read(1))

#This increases the number of characters printed by 1

count+=1

#When 10 characters are printed

if count == 10:

    #This closes the iteration

 break

#This closes the file

file.close()

Read more about file manipulations at:

https://brainly.com/question/16397886


Related Questions

By using perception strategies you have learned, objectively evaluate the following scenario,
You are 16, you have your driver's license, and you want to take some friends to a movie. You
ask your father if you can borrow the car, but he refuses and puts his keys in his pocket. He let
you use the car several days ago.
List the facts: Interpretation #1: Interpretation #2: Request for clarification combined with behavior and interpretations:

Answers

Answer:

book of English

page 91 answer in 2 part

Explanation:

ok bro pls follow me

Answer:

Interpretation #1: My dad wanted to annoy me and didn't want me to have fun.

Clarification: #1: Dad why did you refuse to let me borrow your keys, did I do something wrong? Or did you just want to annoy me.

Interpretation #2: He is worried that something dangerous might happen without any adults in the car and didn't want to rist anyone getting hurt.

Clarification #2 : Dad, do you think we are not going to drive safely? Would you prefer someone older accompanies us?

Explanation:

Before responding to an e-mail from another student in an online course, a student should

Answers

address the student in a polite manner.
-make sure he knows the person
-read the email throughly
-respond in a good manner

Not sure if that can help, but I hope it does! Good luck !


Why should you act as an involver?

Answers

Answer:

To involve people in major and minor situations that is best for the community to be involved in.

[ASAP] Choose the term to complete the sentence.

A _____ is a drawing made up of lines without any surface color or shading.

1. Raster
2. Vector
3. Rendering
4. Wireframe

Answers

A vector is a drawing made up of lines without any surface color or shading. The correct option is 2.

What is vector drawing?

Digital shapes called vectors are formed of lines and curves and are used to build images using mathematical equations. These curves and lines, which are also known as pathways, enable designers to scale pictures that are as simple as shapes or as intricate as full-blown illustrations.

Focus is placed on using only straight lines and contours, without any shading in line drawings. In the majority of line drawings, the artist draws the entire picture without ever taking their tool off the paper.

Therefore, the correct option is 2. Vector.

To learn more about vector drawing, refer to the link:

https://brainly.com/question/3930341

#SPJ1

Answer:

D. Wireframe

Explanation:

Create a brief program that demonstrates use of a Java exception. For example, you could use InputMismatchException and ask the user to input an integer and show that the program executes correctly if they enter an integer and also show that the exception is thrown and a proper error message is displayed to the user if they input a string of letters. You may want to try it with and without a try catch block for practice, but either one will be sufficient for credit.

Answers

Answer:

Here is the program that demonstrates the use of JAVA exception:

import java.util.Scanner;  //to accept input from user

public class Main {  //class name

   public static void main(String[] args) {  //start of main method

      Scanner input = new java.util.Scanner(System.in);  //creates Scanner class object to accept input from user

       int number1 = 0;  //stores the first integer value

       int number2 = 0;  //stores the second integer value

       while(true) {  //keeps looping until user enters integer value

           System.out.println("Enter 2 integers to perform addition: "); //prompts user to enter two integer values

           try {  //defines a chunk of code to check for errors        

               number1 = input.nextInt(); //reads input integer 1

               number2 = input.nextInt(); //reads input integer 2                  

               break;             }  

           catch (java.util.InputMismatchException e) { // defines a code chunk to execute if an error occurs in the try code chunk

              System.out.println("Input must be an integer "); //displays this message if user enters anything other than an integer value

              input.nextLine();              }         }  // reads input from user again until user enters both integer type values

       System.out.println("The sum is: " + (number1+number2));      }  } //if user enters 2 integers then computes and displays the sum of two integer values

Explanation:

The program uses InputMismatchException exception and asks the user to input two integers and computes the sum of two integers if user enters  integers otherwise an exception InputMismatchException is thrown and a error message Input must be an integer is displayed to the user if they input a string of letters instead o f integer values. Here while loop is used which keeps executing until user enters both the integer values. After the user enters correct values, the sum of the two integers are computed and result is displayed on output screen. The screenshot of program and its output is attached.

Another program asks the user to input an integer and the program executes correctly if they enter an integer but exception InputMismatchException is thrown with an error message that is is displayed to the user if they input a string of letters. Here is the program:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       Scanner input = new java.util.Scanner(System.in);

       int number1 = 0;          

       while(true) {

           System.out.println("Enter an integer value: ");        

           try {

               number1 = input.nextInt();  

               break;             }  

           catch (java.util.InputMismatchException e) {

              System.out.println("Input must be an integer ");

              input.nextLine();             }        }  

       System.out.println("The program executed correctly!");  } }

Create a Python script that enables a user to enter an integer number into the Python console and stores such integer number into a variable named input1. Use an if statement to print the following output per the following conditions:If integer is a negative number, print in console "Input1 integer is negative"If integer is zero, print in console "Input 1 integer is zero"If integer is a positive number less or equal than 30, print in console "Input 1 is positive but less or equal than 30.If integer is a positive number greater than 30, print in console "Input1 is positive and greater than 30"

Answers

Answer:

Here is the Python program:

input1 = int(input("Enter an integer: ")) #prompts user to enter an integer

if(input1<0): #if input value is negative

    print("Input1 integer is negative")

elif(input1==0): #if input value is 0

    print("Input 1 integer is zero")

elif(input1<=30): #if input value is less than or equal to 30

    print("Input 1 is positive but less or equal than 30")

else: #if input value is greater than 30

    print("Input 1 is positive and greater than 30")    

Explanation:

I will explain the program with an example

Lets say user enters 16 as input So

input1 = 60

Now the first if condition if(input1<0): is false because 60 is not less than 0

The second elif (else if) condition elif(input1==0): also evaluates to false because 60 is not equals to 0

The third elif condition elif(input1<=30): evaluates to false because the input value is 60 which is not less than or equal to 30.

The fourth else part executes because all the above if elif conditions evaluate to false which means the input number if neither negative, nor 0 and not less than or equal to 30. Hence the input number is greater than 30 and this is true as 60 is greater than 60. So the print statement executes which is:

    print("Input 1 is positive and greater than 30")

The message in the above print statement is printed on the output screen.

The screenshot of the program along with its output is attached.

Given a Student class, create a class with following characteristics:

The class name should be ClassRoom. Private variable students array to maintain the list of Student objects.
Function addStudent with input parameter name (string) and rollNo(int) adds a new student in "students" list.

Method getAllStudents should return all the students in ClassRoom.

Input
Jack

1
Jones
2
Marry
3
where,

First & Second line represent a student’s name and roll number. And so on.

Output

1 - Jack
2 - Jones
3 - Marry

Answers

Answer:

ssume that,

Maximum “students” count can be 10.

*Driver Class*

*Solution class*

import java.util.*;

class Student {

private String name;

private int rollNo;

public String getName() {}

public void setName(String name) {}

public int getRollNo() {}

public void setRollNo(int rollNo) {}

};

class ClassRoom {

private int i;

private Student[] students;

public void addStudent(String name, int rollNo) {}

public Student[] getAllStudents() {}

};

Which range function will generate a list of all odd numbers between 17 and 47 inclusive?

A
range (18 , 48 , 2)

B
range (17 , 47 , 3)

C
range (17 , 48 , 2)

D
range (18 , 47 , 3)

Answers

Answer:

The answer is "range (12, 86, 2)"

Explanation:

Answer:

B is definitely the answer

What does it mean to declare a function versus call a function?​

Answers

Declaring is creating the function. This means that it is initiated but not running. when you run it that means it is activated and taking affect

TRUE or FALSE.
2.1 Information is a collective term used for words, numbers, facts,

Answers

Answer:

true

Explanation:

Because it is the very best way

For question 2 you will need to write your own Python code. Think through the problem, and re-read if necessary. Determine how you might solve the problem logically. Think of what variables you might need to store temporary values. Your friend was bragging about how many stairs he climbed each day because of his apartment location on the fifth floor. Calculate how many times your friend would have to go down then back up the stairs to reach his fifth floor apartment to reach 100, 500, 1000 and 5000 steps. The apartments all have vaulted ceilings, so use 16 steps per floor in your calculations. Remember to count down and back up as one trip. You will also reuse the variable that contains the target number of steps. Round up. HINT: take a look at previous question, and the use of import math and math.ceil(). Recommended variable names you will need for this question: steps_per_floor, floor, target_steps, trips >>>: Write a program that calculates the total number of trips given 100, 500, 1000 or 5000 daily steps, 16 steps per floor, and down and back up the stairs represents one trip. Re-use the target_steps variable. Round the number of trips up to the nearest whole integer. >>>: Display the number of trips for each of the four step counts, using the following example, illustrating the output for 100 steps. Add the other three results below the 100 steps result.

Answers

Answer:

It has to be performed a minimum of  1  trips to do   100 steps

It has to be performed a minimum of  4  trips to do   500 steps

It has to be performed a minimum of  7  trips to do   1000 steps

It has to be performed a minimum of  32  trips to do   5000 steps

All trips need to be  44

Explanation:

open python console and execute the .py code bellow:

import math

floor_steps=16

floor=5

total=0

target_steps=2*floor_steps*floor

trips=100/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   100 steps")

trips=500/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   500 steps")

trips=1000/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   1000 steps")

trips=5000/(target_steps)

trips= math.ceil(trips)

total+=trips

print("It has to be performed a minimum of ",trips," trips to do   5000 steps")

print("All trips need to be ",total)

Maintenance is classified into how many categories ?​

Answers

Answer:

hope it helps..

Explanation:

four types.

More information: Adaptive, corrective, perfective and preventive are the four types of software maintenance.

PLEASE THANK MY ANSWER

____________________ solves the design problem of basic subnetting by allowing different masks on the subnets.

Answers

Answer:

Variable Length Subnet Mask (VLSM)

Explanation:

VLSM is a subnet design strategy that allows all subnet masks to have variable sizes. VLSM solves the design problem of basic subnetting by allowing different masks on the subnets.

I hope this helps!

help me please you don't have to answer all , only 1 is okay. thank you so much​

Answers

Answer:

15 maybe an advertisement?

Explanation:

You use encryption, user accounts, and access control lists (ACLs). However, you find that there is no plan to replace database server hardware if it fails. You find that ordering a replacement server would take at least 24 hours to arrive, and an additional 6 hours to prepare for use. Which part of the C-I-A security triad has failed?

Answers

Based on the scenario, the part of the C-I-A security triad that has failed is maintaining availability.

What is the C-I-A security triad?

The C-I-A security triad refers to an abbreviation for confidentiality, integrity and availability. It can be defined as a cybersecurity model that is designed and developed to guide security policies for information security in an organization, so as to effectively and efficiently protect and make their data available to authorized end users.

In this scenario, the part of the C-I-A security triad that has failed is maintaining availability because the database server hardware cannot be replaced immediately if it fails.

Read more on data here: brainly.com/question/25558534

Murray University invested over $450,000 in a customized learning management system so that professors could put courses online and use the Internet to deliver course content and communications to students. After the first year of use, only 20% of the faculty were using the system. Administrators were frustrated to learn that most faculty found the system difficult to use and that students also had difficulty understanding how to find information on the system. This case is an example of which of the following information deficiencies?

a.Lost or bypassed data
b. User-fierce interfaces
c. Data silos
d. Non-standardized data

Answers

Answer:

b. User-fierce interfaces

Explanation:

Based on the scenario being described it seems this is an example of User-fierce interfaces. This basically means that the system in question is not very user friendly, which ultimately makes it very difficult for users to understand, use, and manipulate. This tends to cause the users to get frustrated and ultimately stop using the system as they believe it is too difficult and not worth their time. This is what seems to be happening with the customized learning management system in this question since the 20% of the users quit instantly due to the difficulty of the system.

In the Visual Basic program language: show how you would prompt a user to enter a value for an integer variable called age.

Answers

Answer:

It would be helpful for you.

Explanation:

Module Module1

   Sub Main()

    ' Read value.

    Dim age As Integer = Console.ReadLine()

    ' Write the value.

    Console.WriteLine("User typed age is " + age )

   End Sub

End Module

Part 1:

In a group, with a friend, or with family members, identify a problem in your community. Describe the problem and work through the steps of problem solving to come to one potential solution. If you can, implement the solution and evaluate the results. If you cannot, propose what may happen if you implemented the solution. Make sure to include all of the steps.

Part 2:

Ask five people for an example of a conflict they have experienced. Look over the approaches to conflict resolution that are listed in the lesson. For each situation, select the approach that you feel would work best. Describe why you selected the approach.

Describe your results for both parts of the project in an essay of at least 300 words.

Long Text (essay)
Submit your 300- word essay that: 1) identifies a problem in your community and works through problem solving steps to provide a solution, and 2) analyzes five conflicts through the conflict resolution approaches and explains an appropriate resolution for each conflict.

Answers

The  problem in my community is lack of pipe borne water.

What are the issues of water supply?

Africa is known to be a content that has some poverish nation. My community is known to lack good water and that is a key issue i would love to address.

What i can do is to write to the government and other private organizations for help or i will take the project upon myself to construct bore holes for the community. A lot of people do not have access to water during the dry season and this will solve the problem.

What are the steps to write an essay?

An essay can be written by following the steps below:

First know the type of Essay you want to write.You introduce the Topic of the essay.State the problem or reasons for writing. Write the body of the writeup.End with a Conclusion.

Note that a good essay is one that that communicate the right message to anyone reading it.

Learn more about water from

https://brainly.com/question/5060579

Give reasons why mind-mapping software is important to project development.

Answers

Answer:

Explanation:Mind mapping software can help you to make connections and become a better creative problem solver.

...

It helps you to make better decisions. ...

It helps you to become better organized. ...

You can see the forest and the trees. ...

It helps you to identify, prioritize and track key project tasks.

A(n) ____ is a location on your computer screen where you type text entries to communicate with the computer’s operating system.

Answers

Answer: Command Line Interface

This is also known as a command prompt.

On many systems, this program has a black background and white text font. You can type in commands such as "cd" which means "change directory", or you could type in "mkdir" to make a directory. The commands I'm listing in the examples apply to windows systems but they may also apply to linux and other systems as well.

What is the first thing Charlotte needs to do after she opens an Excel spreadsheet?

A. Select another program
B. Select a different template
C. Select new blank program
D. Select new blank workbook

Answers

Answer: C

I hope this helps

Define Colors. Detail please.

Answers

Answer:

Colors are complex. They are shades, designs, and an illusion that adds to our reality, truly. We have cones in our eyes to help us see these colors. Issac Newton defined colors. ROYGBIV was the acronym. Really, colors are just designs and shades and illusions we can see for many scientific reasons I can't explain in a few minutes.

Hope this helps!

Ann would like to find all the data that has the least errors. What should Ann do?

*use clustering datamining
*use regression datamining
*conduct a query
*filter the data

Answers

Answer:

use fliter the data

Explanation:

brainly patrol don't take this down, there isn't really an explanation type of question.

functions
of beaker​

Answers

Answer:

Beaker Purpose

Although the purpose of a beaker is to contain and measure liquids, the glassware can come in a multitude of shapes and sizes. Most often, a beaker is cylindrical in shape and has a flat bottom. Some beakers have a small beak or spout to aid in the pouring of liquids.

Here hope that helps know mark me as brill

In Word, how can you tell when text is selected?
A Aselection box appears around the text
B. The text appears in a contrasting color
ООО
C. The text is displayed with an outline
D. A line appears in the margin next to the text
The text is highlighted, often in gray
Save Answer

Answers

Answer:

the text will highlited in gray

Explanation:

PLEASE HURRY!!!!

What can you change, if anything, in this line so that there will not be a space between the dollar sign and the amount of money due?

print("You owe $", moneyDue)

A) You do not need to change anything. There is no space.
B) print("You owe $" , str(moneyDue))
C) print("You owe $" + str(moneyDue))
D) The space cannot be removed.

Answers

Answer:

print("You owe $", moneyDue, sep="")

Explanation:

By default, Python3 will put a space between two strings like this. If you specify that the separator is an empty string (sep="") then it will not separate the two strings and the space will go away.

Answer:

print("You owe$" + str(moneyDue))

Explanation:

It's the one with the plus sign. Correct on EDG 2021 :D

Write a loop that inputs words until the user enters stop. After each input, the program should number each entry and print I. This format:
#1: You entered _____
When stop is entered, the total number of words entered should be printed in this format:
All done ___ words entered.

Answers

Answer:

Written in Python:

userinp = input("Input: ")

count = 0

while not userinp == "stop":

print("You entered "+str(userinp))

count = count + 1

userinp = input("Input: ")

print("All done, "+str(count)+" words entered")

Explanation:

I've added the full program as an attachment where I use comments to explain difficult lines

Answer:

word = input("Please enter the next word: ")

count = 0

while word != "DONE":

      count += 1

      print("#{}: You entered the word {}".format(count, word))

      word = input("Please enter the next word: ")

print("A total of " + str(count) + " words were entered.")

Explanation:

Assuming this is python, this should help!

Why is it now difficult for computer technology to maintain the pace to development describing by Moore’s Law?

Answers

i think it might be A?

Consider the following relations containing information about authors, articles and which author authored which papers (a paper can have several co-authors):

Author(authorID, name)
Authoring(articleID, authorID)
Article(articleID, title, venue, year, month)

Express the following queries in Algebra

a. List the articles authored by John Smith
b. List the co-authors of John Smith (authors who co-authored an article with John Smith)
c. List all the articles published last year
d. List pairs of articles that have the same titles with different article IDs
e. List the authors with no article in the database
f. List the authors who have all their papers co-authored with John Smith
g. List the papers authored by only one author (without aggregate functions)
h. Which author co-authored at least 1 paper with every author (without aggregate functions)
i. List the authors who have all their papers co-authored only with John Smith (No other co-author)

Answers

Answer:

The description of the given point can be defined as follows:

Explanation:

In option a:

List the articles authored by John Smith

[tex]\pi[/tex]Article.title ([tex]\delta[/tex](Author.authorID=Authoring.authorID)^ (Article.articleID=Authoring.articleID)^ (Author.name=’John Smith’) (Article [tex]\times[/tex] Authoring [tex]\times[/tex] Author))

In option b:

Listed all John Smith but also Marc Antoine's articles  

[tex]\pi[/tex] Article.title ([tex]\delta[/tex](Author.authorID=Authoring.authorID)^ (Article.articleID=Authoring.articleID)^

(AUTOR.NAME='JohnSmith 'or "John Smith'Marc Antoine" )

(article [tex]\times[/tex] Authoring  [tex]\times[/tex] Author)

In option c:

Review the John Smith co-authors (authors co-authors with John Smith)  

ID (Author.authorID = Authoring.authorId)^(Article.articleID =Authoring.articleID)^(Article.articleID = Authoring.articleID)^  

(Author.name='John Smith') (Paragraph x Author)  

[tex]\pi[/tex]  Article.title ([tex]\delta[/tex](article.item ID = Addresse.itemID)^(Authoring.art.item = art)  

(Paragraph [tex]\times[/tex] Authoring)

In option d:

List all of that year's papers  

[tex]\delta[/tex] (Article.year=2019)  

In option e:

List the authors without a database post  

authorInDatabase = [tex]\pi[/tex] Authoring.authorID (δ(Author.authorID=Authoring.articleID) )

(Author [tex]\times[/tex] Authoring)

authorTotal =  Author.authorID (δ (Author.authorID=Authoring.articleID)

(Author [tex]\times[/tex] Authoring)

AuthorsWithNotWithArticles = authorTotal - AuthorInDatabase

In option f:

Listed of writers that have co-authored both published publications to John Smith  

Authors = [tex]\pi[/tex]  Book.authorID ([tex]\delta[/tex] Author.authorID)^(Article.articleID = Authoring.articleID)^ Authoring.articleID)^ Book Authors  

(Paragraph [tex]\times[/tex] Authoring) (Author.name='John Smith')  

[tex]\pi[/tex] Author.name ([tex]\delta[/tex] (Art.articleID = Author.articleID)^(Authoring.authorID = Authoring. Authoring. AuthorID)  

(Physician[tex]\times[/tex] Authoring)

7. Suppose that a RISC machine uses 5 register windows. a. How deep can the procedure calls go before registers must be saved in memory? (That is, what is the maximum number of "active'' procedure calls that can be made before we need to save any registers in memory?) b. Suppose two more calls are made after the maximum value from part (a) is reached. How many register windows must be saved to memory as a result? c. Now suppose that the most recently called procedure returns. Explain what occurs. d. Now suppose one more procedure is called. How many register windows need to be stored in memory?

Answers

Answer:

bbbbbbbbbbbbnbbnnnnnnnnnnnnnnnnn

Other Questions
Calculate the average of the following numbers: 14, 8, -17, -8, 18? You are a NASCAR pit crew member. Your employer is leading the race with 20 laps to go. He just finished a pit stop and has 5. 0 gallons of fuel in the tank. On the way out of the pits, he asks, "Am I going to have enough fuel to finish the race or am I going to have to make another pit stop?" You whip out your calculator and begin your calculations based on your knowledge of stoichiometry. Other information you know is: C5H12 + O2 -> CO2 + H2O The car uses an average of 300. 0 grams of O2 for each lap. The formula for fuel is C5H12 The fuel has a density of 700 g/gal. What do you tell the driver? 3 laws or legislation that were signed by a president during the gilded age Question 5Indicate the answer choice that best completes the statement or answers the question.What is the value of x in the triangle below? Which speech made a stronger use of the appeal to reason? Write two paragraphs that compare and contrast both speeches in terms of their appeals to reason.Provide specific examples from the text to support your point. Use proper spelling and grammar. Hi. Ok, so I'm applying to be a Belle (It's a community thing) and I have to write a paragraph about why I'm applying and why I'd like to be selected. For some context, the Belles are an organization that does charity work and like town functions and stuff like that. Anyway, I'm bad at giving reasons why I want to do something, so I'm kinda stuck. How do I appeal to the people reading it and how do I word it without making it sound like I'm listing why I should be accepted? Because that's not technically what they were asking. Pleasee help me ,write an email of adviceee((( what is the denotative meaning of the word blue ? I need help please I just need the code to pass Denise drew a diagram of part of a slide at a community playground.The slides ladder forms two angles with the ground.The measurement of one angle is half the measurement of the other.What are the measures of the angle show your work. Which is an appropriate element of a stress management plan?limiting social interactionso reducing daily exerciseidentifying coping strategiesavoiding opportunities to have fun A student releases a ball from 1. 5m from the floor. Which statement best describes the energy of the ball as it falls? how many repeating digits are in 0.37? From 1990 to 2000, the population of California can be modeled by P = 29, 816,591(1.0128) where t is thenumber of years since 1990.A. What was the population in 1990?B. What is the growth factor?C. What is the annual percent increase?D. Estimate the population in 2007. Read the following sentence from the section "What Is The History Between Russia And Ukraine?" Nearly 14,000 people have died in the conflict and there are 1.5 million people internally displaced in Ukraine. What is the meaning of the phrase "internally displaced" as it is used in the sentence? O a. people unable to leave their homes but who seek emergency shelter Ob. people who have been injured and need medical care and shelter O c. people forced to flee their homes but who remain in their country O d. people who have been able to find refuge in a nearby country HURRY I HAVE 8 MINUTES LEFT!The graph for the equation y = x minus 4 is shown below.On a coordinate plane, a line goes through (0, negative 4) and (4, 0).Which equation, when graphed with the given equation, will form a system that has an infinite number of solutions?O- y - x = -4O- y - x = -2O- y - 4 = xO- y + 4x = 1 state the effect of momentarily touching the conductor with a finger while the charged rod is still near the conductor The question is in the picture, please help. I need help on it pls pls how do sea cave ,stack and sand duneform please answer quickly