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
Jlenok [28]
3 years ago
10

# q7 - create function readFileFirstLast() to meet the conditions below

Computers and Technology
1 answer:
MAVERICK [17]3 years ago
3 0

Answer:

See explaination

Explanation:

def readFileFirstLast(filename):

# doc string

''' Function accept the filename and opens the fle

and reads all lines and strips new line character and

stores first and last in a string and return that string'''

#eception handle if file not found

try:

#opening the file

f = open(filename)

#reading the first line and striping the ne line

string = f.readline().strip()

#iterating until last line

for line in f:

pass

#concate the last line after strip the new line character to the string

string = string + " " + line.strip()

#return the string

return string

except:

#if file not found

return "File not found"

#taking the file name from user

filename = input("Enter a file name: ")

#printing the doc string in function

print("\ndoc_sting: \n"+ readFileFirstLast.__doc__+"\n")

#printing the returned string by calling the readFileFirstLast()

print("output string :")

print(readFileFirstLast(filename))

You might be interested in
A derived class is a class that inherits data members and functions from a ____ class.
mezya [45]
The answer is superclass
6 0
3 years ago
Using the Sakila database, create a query that displays the film title, description, as well the actor first and last name for a
Alex787 [66]

Answer:

Select title, description , first_name, last_name from film inner join film_actor on film.film_id = film_actor.film_id inner join actor on film_actor.actor_id = actor.actor_id where title LIKE 'zo%';

Explanation:

  • The INNER JOIN keyword selects records that have matching values in both tables.
  • The WHERE clause is used to filter records.
  • The WHERE clause is used to extract only those records that fulfill a specified condition.
7 0
3 years ago
Explain the unique reason why assember language is perfered to high level language
Zigmanuir [339]

The unique reason why assembler language is preferred to high level language is that  It is said to be memory efficient and it is one that requires less memory.

<h3>Why is assembly language better than other kinds of high level?</h3>

It implies means that the programs that one uses to write via the use of high-level languages can be run easily on any processor that is known to be independent of its type.

Note that it is one that has a lot of  better accuracy and an assembly language is one that carries out a lot of better functions than any high-level language, in all.

Note also that the advantages of assembly language over high-level language is in terms of its Performance and accuracy as it is better than high-level language.

Hence, The unique reason why assembler language is preferred to high level language is that  It is said to be memory efficient and it is one that requires less memory.

Learn more about assembler language from

brainly.com/question/13171889

#SPJ1

3 0
1 year ago
+
quester [9]

Answer:

Network administrator

5 0
3 years ago
Read 2 more answers
The web server software used has a significant impact on how a web site's web pages look on a user's computer.
soldi70 [24.7K]
False. Apache (which serves about 63% of the web pages) just serves the files. How it looks is a combination of the HTML and CSS that the site uses.
6 0
3 years ago
Other questions:
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • The four key stages with regards to data visualization workflow. Select one key stage and explain it briefly about that stage.St
    10·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • Anybody know this question??
    8·1 answer
  • 2.8 Code Practice: Question 2
    11·1 answer
  • Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​
    8·2 answers
  • Why do you think that network and telecommunications security careers are some of the fastest growing in the field of technology
    8·1 answer
  • The operating system (OS) of an information system contains the software that executes the critical functions of the information
    6·1 answer
  • Suppose the cache access time is 10ns, main memory access time is 200ns, and the cache hit rate is 90%. Assuming parallel (overl
    10·1 answer
  • The layer of the ISO/OSI responsible for source to destination delivery.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!