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
Type size in a textbook may be used to indicate the relative importance of ideas.
Alborosie
Yes true 

hey is this one of your questions on a science packet if so it is called explore ring Earth's surface because I have the same packet with the same question on it
3 0
2 years ago
Read 2 more answers
How has the global marketplace used emerging technologies to expand businesses
madam [21]

Answer:

Information Technology (IT) has revolutionized the way organizations conduct business by enabling small and medium businesses to level the playing field with larger organizations. Small businesses use an array of technology based on everything from computer server stations to portable mobile devices to expand competitive advantages in the global economic marketplace and marketing environment. So, small & medium business organizations owners are considering implementing information technology (IT) in their planning process for streamlined integration. Thus, this process is leading to future business expansion locally as well as globally. This decision allows proprietors to create smooth business operations using the most effective information technology available. On the other hand, the Internet has further linked the overseas suppliers of goods and services and their buyers. During the e-commerce era, internet traffic is increasing day by day, and e-commerce business is in the hyper growth stage. Information technology tremendously helps to boost the expansion of the current and future of marketing environment; communication technology became faster than ever. Though, globalization creates a little challenge for multinational companies to share resources and knowledge across a number of businesses inside and outside the country. Outsourcing and freelancer ease this challenge because multinational companies recruit talent freelancers and outsource their projects to the highly expert vendors and then the works are done through the team of people very effectively and efficiently.

Explanation:

6 0
2 years ago
Write a short paragraph explaining why cross-training employees is imperative.
harina [27]
<span>One of the main deterrents to cross-training is how employees feel about retaining knowledge. An employee may feel their job is threatened if someone else is being trained in their function. It's important that you lay these woes to rest and explain why you are cross-training your employees.</span>
4 0
3 years ago
can somebody tell me what straykids 2021 collab is gonna be with because i think its gonna be with blackpink
valkas [14]

Answer:

Red velvet: Red Velvet made its debut in 2014, so it is highly probable that SM Entertainment might announce whether or not members of the group will continue to stay in the company by the end of 2021.

Explanation:

Probably black and white, or gold and white Or Gucci clothes.

7 0
2 years ago
Read 2 more answers
Hi, I need help on a Circle Class Assignment that is due today. If anyone could please help me, I would greatly appreciate it. I
nikklg [1K]

Answer:

hmmm lets see

Explanation:

7 0
3 years ago
Other questions:
  • What are informational sessions?
    10·1 answer
  • True or False?
    8·1 answer
  • What fields of engineering are in Biomedical
    7·1 answer
  • Give an O(log m + log n)-time algorithm that takes two sorted lists of sizes m and n, respectively, as input and returns the ith
    7·1 answer
  • Dang was accepted to a biology program with a rigorous schedule and a high tuition, but good professors. What would be a benefit
    10·2 answers
  • What is the purpose of the literature review section of research paper
    14·1 answer
  • Whats the correct answer
    15·2 answers
  • Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after th
    15·1 answer
  • Write a program to find the sum of first 10 even numbers in qbasic​
    15·1 answer
  • Molly needs to access a setting in microsoft windows group policy to change the type of a network to which a computer is attache
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!