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
ludmilkaskok [199]
3 years ago
5

A teacher wants a program to give extra points to students who fail a test. Write a Python program to do the following: (a) Ask

the user to enter 5 test scores. Store the scores in a list. Display the list. (b) Copy all 5 test scores to another list. Use a loop to examine each test score in the new list. If the score is below 60, add 10 extra points to the score. Display the list. (c) Compare the old score and new score of each student. If the old score and new score are different, display the two scores.
Computers and Technology
1 answer:
Lorico [155]3 years ago
8 0

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);

You might be interested in
Operating systems are designed to work with specific hardware. Which operating system works with Apple computers?
Ghella [55]
2. Mac and to be more precisely, OS X
5 0
3 years ago
Read 2 more answers
An executable file that was determined to be infected with a virus was terminated from the running processes list. However, afte
Mama L [17]

Mostly Trojan will has multiple version and I love u virus extra.

<u>Explanation:</u>

As first step workstation or desktop or laptop to scanned for virus and if any virus or malware found then it should be removed first. Operating system should be updated with latest patch, virus signature also be updated once again executed founded by virus infected.

Better to copy new exes and place in the same folder and try to execute again. If still the problem persists download antivirus software such as Norton, bit defender, Kaspersky etc. executable files affected by 15-20 viruses

8 0
2 years ago
Use a VLOOKUP function in cell I5 to identify and calculate the federal withholding tax. Use the tax rates from the range D21:E2
SVEN [57.7K]
In the Cell 'H13' of Sheet 'Payroll Data', the 'Formula' was not set to 'G13-B13*$B$24'.
6 0
3 years ago
Omar wants to know how his organization has been doing financially over the last year. He wants to also compare this information
IRINA_888 [86]

C is the right answer for apex

8 0
2 years ago
Read 2 more answers
You decide to buy some stocks for a certain price and then sell them at another price. Write a program that determines whether o
ser-zykov [4K]

Answer:

#here is code in python.

#read number of shares

num_share = int(input("Enter number of shares:"))

#read purchase price

buy_p = float(input("Enter purchase price:"))

#read sell price

sell_p = float(input("Enter sale price:"))

#total buying cost

buy_cost=buy_p*1.03*num_share

#total selling cost

sell_cost=sell_p*0.97*num_share

#if net profit

if(sell_cost>buy_cost):

   print("After the transaction, you made " +str(sell_cost-buy_cost)+ " dollars.")

#if net loss

else:

   print("After the transaction, you lost " +str(buy_cost-sell_cost)+ " dollars.")

Explanation:

Read the total number of shares from user.Then read buying price of a share and selling price of a share.Then calculate total buying cost including commission.Calculate total selling cost excluding the commission.If total buying cost is greater than total selling cost the print the profit else print the loss in the transaction.

Output:

Enter number of shares:10

Enter purchase price:10

Enter sale price:10

After the transaction, you lost 6.0 dollars.

4 0
3 years ago
Other questions:
  • Do we have to use intersection?
    6·1 answer
  • if i set my payment and use free trial on Scribd website, can i cancel my payment and NOT PAYING after one month??
    8·1 answer
  • Who is hurt by piracy
    10·1 answer
  • When your friend DaJuan turns on his computer, he hears four beeps. The computer won’t fully boot. DaJuan has a Dell computer wi
    7·1 answer
  • Write a method that determines the total number of chars in each string of an array.
    12·1 answer
  • Please help!<br><br> What is a non-iterative programming structure?
    11·1 answer
  • What font family is Times New Roman an what font family is Arial?
    9·2 answers
  • What are the four steps for planning a table?​
    10·1 answer
  • Fill in the table below of the Interactive Word Wall. You are provided with the
    13·1 answer
  • Two technicians are discussing Newton's first law of motion. Technician A says that a lightweight vehicle requires as
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!