Answer:
False.
Explanation:
In C programming language the file which containing the code that we are writing the code is have the file extension .c and for c++ it is .cpp. C programming language is a general purpose procedural computer programming language.
.g file extension is for data chart file format used by APPLAUSE database development software.
Hence the answer to this question is false.
Answer:
Patent violation.
Explanation:
Patent can be defined as the exclusive or sole right granted to an inventor by a sovereign authority such as a government, which enables him or her to manufacture, use, or sell an invention for a specific period of time.
Generally, patents are used on innovation for products that are manufactured through the application of various technologies.
Basically, the three (3) main ways to protect an intellectual property is to employ the use of trademarks, copyright and patents.
In this scenario, a programmer hacks software code to understand how it works. Then she writes a program that replicates the implementation of a solution that has already been granted intellectual property protection.
Hence, this is an example of a patent violation because she was not given the permission or rights by the intellectual property owner to modify the software.
Answer:
- def average_num_in_file(fileName):
- with open(fileName) as file:
- rows = file.readlines()
-
- sum = 0
- count = 0
- for x in rows:
- sum += float(x)
- count += 1
-
- average = sum / count
- return average
-
- print(average_num_in_file("cans.txt"))
Explanation:
The solution code is written in Python 3.
Firstly create a function that take one parameter, fileName (Line 1).
Open the file stream and use readlines method to read the data from the file (Line 2-3). Create variable sum and count to tract the total of the number from text files and number of data from the file (Line 5-6). Use a for loop to loop over each row of the read data and add the current value of each row to sum and increment the count by one (Line 7-9).
After the loop, calculate the average (Line 11) and return the result (Line 12).
At last, we can test the function by passing the cans.txt as argument (Line 14).