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
For security reasons a network administrator needs to ensure that local computers cannot ping each other. which settings can acc
liq [111]
<span>The administrator of the network can access the admin settings on the network's primary DNS servers. From there, there are hundreds of various settings and changes to make. There is one, however, that is able to disable pings. This will prevent computers from responding to ping requests. This can help to ensure internal security and reduce internal network traffic.</span>
6 0
3 years ago
Universal Containers (UC) uses a custom object called Vendor. The Vendor custom object has a Master-Detail relationship with the
Rudik [331]

Answer:

The account record comprises of Invoice roll up summary fields.

Explanation:

The possible reason that this change was not permitted was that the account record comprises of Invoice roll up summary fields.

Invoice roll up summary fields: A roll-up summary field computes values from associated records, for example those in a linked list. a person or someone ca design a roll-up summary field to show a value in a master record by building  the values of fields in a particular record.

The detail record must be associated to the master through a master-detail relationship. for instance, you want to show the sum of invoice amounts for all linked custom object records in an account’s Invoices related list. you can show the whole or sum in a custom account field refereed to as Total Invoice Amount.

4 0
3 years ago
Your boss wants to utilize some sort of cloud storage for his files so that all of his
Valentin [98]

Well, if he's using Google Drive or OneDrive it shows up in the main menu so My best guess would be Local Profile

4 0
4 years ago
Read 2 more answers
Questione
umka2103 [35]

Answer:

According to my physics all of functinalitys are made of angles and binary code to perform a new formula and involved to each sides....

Explanation:

HOPE IT HELPS!!!i translate into G your language

5 0
3 years ago
It is the "executable" phrase of Word<br>Wide Web with dynamic applications,?<br>​
Mkey [24]

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

4 0
3 years ago
Other questions:
  • Given non-negative integers x and n, x taken to the nth power can be defined as: x to the 0th power is 1 x to the nth power can
    7·1 answer
  • If a ≤m b and b is regular, does that imply that a is a regular language? why or why not?
    6·1 answer
  • LDAP is an industry standard employed by Microsoft, which enables IT departments to use a(n) __________ structure when creating
    7·1 answer
  • Which statement is true about the elements of the interface of a presentation program? The status bar appears at the top of the
    14·2 answers
  • A sonar operator on a battleship looks at a display that contains a spatial layout of the distribution of echoes from the surrou
    6·1 answer
  • Wap to input any multi digits number and display the sum of odd digits and even digits​
    5·1 answer
  • Task 1: Alex has created the following code using Scratch and expected it to move backwards and forwards across the screen. Howe
    13·1 answer
  • What is the difference between KE an PE
    8·1 answer
  • What is the importance of shape in graphic design?​
    5·2 answers
  • How are most databases organized?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!