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
iogann1982 [59]
2 years ago
8

Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of

job. It also maintains a file of estimates given for jobs not yet performed; this file contains a customer number, name, address, proposed date of job, and proposed price. Each file is in customer number order.
Required:
Design the logic that merges the two files to produce one combined file of all customers whether past or proposed with no duplicates; when a customer who has been given an estimate is also a past customer.
Computers and Technology
1 answer:
gulaghasi [49]2 years ago
8 0

Answer:

Hence the complete implementation of python code that reads two files and merges them together.

def merge_file(past_file_path,proposed_file_path, merged_file_path):

   past_file_contents=load_file(past_file_path)

   proposed_file_contents=load_file(proposed_file_path)

   proposed_customer_name = []

   for row in proposed_file_contents:

       proposed_customer_name.append(row[1])

   with open(merged_file_path,'w') as outputf:

       outputf.write("Customer Number, Customer Name, Address\r\n")

       for row in proposed_file_contents:

           line = str(row[0]) +", " + str(row[1]) + ", " + str(row[2]) +"\r\n"

           outputf.write(line)

       for row in past_file_contents:

           if row[1] in proposed_customer_name:

               continue

           else:

               line = str(row[0]) + ", " + str(row[1]) + ", " + str(row[2]) + "\r\n"

               outputf.write(line)

       print("Files merged successfully!")

# reads the file and returns the content as 2D lists

def load_file(path):

   file_contents = []

   with open(path, 'r') as pastf:

       for line in pastf:

           cells = line.split(",")

           row = []

           for cell in cells:

               if(cell.lower().strip()=="customer number"):

                   break

               else:

                   row.append(cell.strip())

           if  len(row)>0:

               file_contents.append(row)

   return file_contents

past_file_path="F:\\Past Customer.txt"

proposed_file_path="F:\\Proposed Customer.txt"

merged_file_path="F:\\Merged File.txt"

merge_file(past_file_path,proposed_file_path,merged_file_path)

You might be interested in
1. Grade data is:
horrorfan [7]

Answer:

1.)

import math

def min_max(lst):

   minimum = math.inf

   maximum = -math.inf

   for x in lst:

       if minimum > x:

           minimum = x

       elif maximum < x:

           maximum = x

   return minimum, maximum

2.)

def deltaGrade(lst):

   sm = 0  #sm is sum

   for x in lst:

       sm += x

   mean = sm/len(lst)

   deltaG = 75 - mean

   return deltaG

7 0
3 years ago
16.
dimaraw [331]
  • Answer:

<em>r = 15 cm</em>

  • Explanation:

<em>formula</em>

<em>V = πr²×h/3</em>

<em>replace</em>

<em>4950 = 22/7×r²×21/3</em>

<em>4950 = 22/7×r²×7</em>

<em>4950 = 22×r²</em>

<em>r² = 4950/22</em>

<em>r² = 225</em>

<em>r = √225</em>

<em>r = √15²</em>

<em>r = 15 cm</em>

3 0
2 years ago
Unless you explicitly initialize global variables, they are automatically initialized to
shusha [124]

Answer:

Zero(0)

Explanation:

<u>Global Variables </u>

Variables which are declared outside any function. Any function can use these variables,they are automatically initialized to zero(0).They are generally declared before main() function.

Example- C program for showing global variable is 0.

  #include <stdio.h>

   int g;  // declaring g as global variable

   int main()

   {

       printf("%d",g);  //printing global variable

       return 0;

    }

<u>Output</u>

  0

4 0
3 years ago
Why wont my account update from Expert to Ace? I have all the points and branliests to be Ace but it wont update
grin007 [14]

Answer:

Maybe you don't have all the points and brainliests needed. Double check and if you actually don't, try to reload your device. If it still isn't working, there is something wrong with your device.

Explanation:

PLEASE MARK ME AS BRAINLIEST I REALLY WANT TO LEVEL UP

8 0
2 years ago
Read 2 more answers
Do you agree to the song that ''magtanim ay di biro?'' why?
iren [92.7K]

Answer:

I agree in this song because being a farmer is not easy you need to be hardwork

5 0
2 years ago
Other questions:
  • How to search for the largest files on my computer vista?
    5·1 answer
  • When computing the cost of the basket of goods and services purchased by a typical consumer, which of the following changes from
    11·1 answer
  • The Windows taskbar is generally found _____. at the top of the screen in the Start menu at the bottom of the screen at the righ
    14·2 answers
  • White lines
    7·2 answers
  • What can you use on Code.org's Web Lab to find and fix problems when you are writing code for your website?
    13·1 answer
  • Technology changes rapidly. Do you think the development of new technology will slow down at some point? At some point will cons
    12·1 answer
  • A total stranger is trolling Jack online. He’s offended and annoyed. How can Jack stop the troll in his or her tracks? (5 points
    10·2 answers
  • My brainly isnt working it isnt showing and answers wats going on? wat do i do
    14·2 answers
  • How ict tools changed the way we live explain it​
    12·1 answer
  • Write l for law of enrtia,ll for law of Acceleration and lll for law of enteraction.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!