1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
erastovalidia [21]
2 years ago
6

Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the

screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been displayed.
Computers and Technology
1 answer:
tangare [24]2 years ago
5 0

Answer:

Written in Python

filenm = input("File name: ")

myfile = open(filenm+".txt")

for i in range(10):

     line = myfile.readline()

     print(line)

print("End of file")

Explanation:

This line prompts user for file name

filenm = input("File name: ")

This line creates an instance of the file

myfile = open(filenm+".txt")

This line iterates through the 10 lines

for i in range(10):

This line reads the line

     line = myfile.readline()

This line prints each line

     print(line)

This line prints a message indicating that all possible lines have been printed

print("End of file")

You might be interested in
Which of the following is not part of the processes involved in data valida
sineoko [7]

Answer:

B Fraud because it's aganist the data valida

5 0
3 years ago
Which of the following is true of how computers represent numbers?
Bumek [7]

Answer:

C. Binary can be used to represent more complex, higher level abstractions, including but not limited to numbers, characters, and colors. D. When data is large enough computers switch to using decimal representation instead of binary, because you can represent larger numbers with fewer digits

Explanation:

4 0
3 years ago
Read 2 more answers
Does any one here play destiny on xbox one
timurjin [86]

No .


Sorry , but I never try them ,

6 0
3 years ago
Let X and Y be two decision problems. Suppose we know that X reduces to Yin polynomial time. Which of the following statements a
DerKrebs [107]

Answer:

d. If X is NP - complete and Y is in NP then Y is NP - complete.

This can be inferred

Explanation:

The statement d can be inferred, rest of the statements cannot be inferred. The X is in NP complete and it reduces to Y. Y is in NP and then it is NP complete. The Y is not in NP complete as it cannot reduce to X. The statement d is inferred.

4 0
3 years ago
In a word processor, Tariq chooses Options from the Tools menu and then selects the Track Changes tab. Which of the following ta
bearhunter [10]

Highlight Changes

Compare Documents

3 0
3 years ago
Other questions:
  • The use of digital technology and the Internet to execute the major business processes in the enterprise is called
    11·1 answer
  • Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Rom
    13·1 answer
  • Amazon Web Services (AWS): Group of answer choices a) forms a majority percentage of Amazon's overall revenue. b) was introduced
    15·1 answer
  • A very simple device that connects network components and sends packets of data to all other connected devices is called a _____
    5·1 answer
  • What are the coordinates of (3 comma space 8 )relative to the basis open curly brackets space (1 comma space 1 )comma space (0 c
    15·1 answer
  • A web browser allows you to manage computer files and programs true false
    15·1 answer
  • When a computer is booted the checks the computer's components?
    7·1 answer
  • How should you decide what to wear to an interview? What kind of things should be considered?
    12·1 answer
  • What is the term for an understanding about the processes that underlie memory, which emerges and improves during middle childho
    7·2 answers
  • A vacuum tube that contains a grid can be classified as a A. rectifier B. triode C. pentode D. diode
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!