Answer:
The Basic Program is as follows:
10 LENGTH = 50
15 WIDTH = 30
20 AREA = WIDTH * LENGTH
25 PRINT AREA
30 END
The Algorithm is as follows:
1. Start
2. Let Length = 50
3. Let Width = 30
4. Compute Area = Length * Width
5. Display Area
6. Stop
See Attachment for flowchart (flowchart is designed using draw io tools)
Explanation:
The flowchart, algorithm and basic program all follow the same sequence and explanation
Using the basic program as a case study;
Line number 10: The program starts by initializing LENGTH to 50
Line number 15: It then initializes WIDTH to 30
Line number 20: The AREA is calculated by LENGTH * WIDTH
Line number 25: The value of AREA is printed afterwards
Line number 30: Lastly, the program stops execution
Books,well trusted websites , news.reports , schools library (online and off ) hope this helps.:-)
If (sales >= 10000)
commission = 0.2;
Answer:
Hi there! Please find the answer below.
Explanation:
The program below demonstrates how each of the requirements can be coded in a simple Python script. To copy the array, we can use the copy() method of the array. To calculate the diff, we can use a few different techniques, so I have implemented it using a loop over the arrays and just storing and displaying the difference in the 2 arrays.
new_string.py
def add_test_score(score):
test_score.append(score);
contact_hash = {}
test_score = []
print("Enter 5 test scores: ");
for x in range(0, 5):
input_string = input("Enter test score " + str(x + 1) + ": ")
add_test_score(int(input_string));
print(test_score);
test_score_copy = test_score.copy();
for e in test_score_copy:
if e < 60:
test_score_copy[test_score_copy.index(e)] += 10;
diff = [];
for e in test_score:
print(test_score[test_score.index(e)]);
print(test_score_copy[test_score.index(e)]);
if not test_score[test_score.index(e)] == test_score_copy[test_score.index(e)]:
diff.append(e);
print(diff);