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
zzz [600]
4 years ago
7

Define stubs for the functions get_user_num) and compute_avg). Each stub should print "FIXME: Finish function_name" followed by

a newline, and should return -1. Each stub must also contain the function's parameters Sample output with two calls to get_user_num) and one call to compute_avg): FIXME: Finish get_user_num() FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 1 ' Your solution goes here '' 2 4 user_num1 = 0 5 user_num2 = 0 6 avg_result = 0 7 8 user_num1 = get_user_num 9 user_num2 = get_user_num ) 10 avg_result = compute_avg(user_num1, user_num2) 11 12 print'Avg:', avg_result)|

Computers and Technology
1 answer:
Allisa [31]4 years ago
6 0

Answer:

Here are the stub functions get_user_num() and compute_avg()

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1

Explanation:

A stub is a small function or a piece of code which is sometimes used in program to test a function before its fully implemented. It can also be used for a longer program that is to be loaded later. It is also used for a long function or program that is remotely located. It is used to test or simulate the functionality of the program.  

The first stub for the function get_user_num() displays FIXME: Finish get_user_num() and then it returns -1.

The seconds stub for the function compute_avg() displays the FIXME: Finish compute_avg() and then it returns -1.

Here with each print statement, there is function name after this FIXME: Finish line. The first function name is get_user_num and the second is compute_avg().

Next the function get_user_num() is called twice and function compute_avg() followed by a print statement: print('Avg:', avg_result) which prints the result. So the program as a whole is given below:

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1  

user_num1 = 0  # the variables are initialized to 0

user_num2 = 0

avg_result = 0  

user_num1 = get_user_num()  #calls get_user_num method

user_num2 = get_user_num()

avg_result = compute_avg(user_num1, user_num2)  

print('Avg:', avg_result)

The method get_user_num() is called twice so the line FIXME: Finish get_user_num() is printed twice on the output screen. The method compute_avg() is called once in this statement avg_result = compute_avg(user_num1, user_num2)   so the line FIXME: Finish compute_avg() is printed once on the output screen. Next the statement print('Avg:', avg_result) displays Avg: -1. You can see in the above program that avg_result = compute_avg(user_num1, user_num2)   and compute_avg function returns -1 so Avg= -1. The program along with the produced outcome is attached.

You might be interested in
What initialization vector (IV) do most weak implementations of the Wireless Equivalency Protocol (WEP) use
Katen [24]

24 bits is an initialization vector (IV) which is used by most weak implementations of the Wireless Equivalency Protocol (WEP).

<h3>What is Wireless Equivalency Protocol (WEP)?</h3>

Wireless Equivalency Protocol (WEP) can be defined as a standard wireless protocol that is designed and developed to provide a significant level of security and privacy on 802.11b wireless local area network (WLAN).

According to the IEEE Wireless Fidelity (Wi-Fi) standard, 24 bits is an initialization vector (IV) which is used by most weak implementations of the Wireless Equivalency Protocol (WEP).

Read more on Wireless Equivalency Protocol here: brainly.com/question/13697151

#SPJ1

5 0
3 years ago
Information technology student Roberta has been assigned a project on how to detect unwanted outgoing attacks. Which step is par
tino4ka555 [31]

The attacks from the malware and the viruses to the system are considered as the unwanted attacks. These attacks detection can be performed by ensuring whether the system responds to port 443 by initiating Apache.

<h3>What is the function of port 443?</h3>

The port 443 in the computer system is the virtual port that functions with the diversion of the network. The presence of the unwanted attack blocks the response of the port 443.

Therefore, to detect the attack, the response of the system to port 443 with the starting of Apache must be checked.

Learn more about port 443, here:

brainly.com/question/13140343

#SPJ1

5 0
2 years ago
Add an array, which will store the most recent 5 recent transactions. For the array, add an insert function which will store the
Vika [28.1K]

The answer & explanation for this question is given in the attachment below.

Download docx
4 0
3 years ago
Select the correct answer.
aliina [53]

Answer:

B

Explanation:

engineers design and carry out test cases and evaluate exit criteria (by following the scope set in the planning phase). They create bug reports describing detected defects and report to the stakeholders on the test findings and the completion status. Testing may be repeated to check for errors.

7 0
4 years ago
What trends do you see in the industry in 2010? For example, if there were more or fewer jobs created by travel and tourism, rep
Setler [38]

Answer:

i saw phones and more social media being used mobile gaming was also invented

Explanation:

me smart birb

4 0
4 years ago
Read 2 more answers
Other questions:
  • A network TAP serves what purpose on a network?
    7·1 answer
  • Your company runs a commercial website that enables your business partners to purchase products and manage their accounts. You w
    9·1 answer
  • Pretend that you are Ana’s co-worker, what constructive advice would you give Ana about her on-the-job actions?
    10·2 answers
  • Assume that a text box named PhoneNumberTextBox appears on a form and contains the phone number 414-555-5555. What value will di
    5·1 answer
  • Some projectors use a connection technology called _______________ that enables long-range connectivity for uncompressed HD vide
    12·1 answer
  • Consider a system that contains 32K bytes. Assume we are using byte addressing, that is assume that each byte will need to have
    10·1 answer
  • In the negative side of the battery, there are millions and millions of _________.
    14·1 answer
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
  • It is a kind of malware (malicious software) that criminals install on your computer so they can lock it from a remote location.
    15·2 answers
  • Multiple Choice
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!