Answer:
def prompt_number():
while True:
number = int(input("Enter a number: "))
if number >= 0:
break
return number
def compute_sum(n1, n2, n3):
total = n1 + n2 + n3
return total
n1 = prompt_number()
n2 = prompt_number()
n3 = prompt_number()
result = compute_sum(n1, n2, n3)
print(result)
Explanation:
Create a function named prompt_number that asks the user to enter a number until a positive number or 0 is entered and returns the number
Create a function named compute_sum that takes three numbers, sums them and returns the sum
Ask the user to enter three numbers, call the prompt_number() three times and assign the values
Calculate the the sum, call the compute_sum and pass the numbers as parameters
Print the result
Answer:
See explaination
Explanation:
Here are the steps taken to draw the diagram!
opcode0 and the opcode1 signals are inverted/not to determine the case whether it is 00, 01, 10, 11.
Then they are 'and'ed with the corresponding Zero/lt signal to confirm if the case is true, for eg. zero = 1 if opcode = 00 (beq).
Then all the cases are 'or'ed to get the Branch signal!
See attachment for the diagram
Answer:
b. The names in the list should be in alphabetical order.
Explanation:
A binary search is an algorithm used for searching for an item in a list or array. The algorithm first sorts the data structure into order and then divides it into halves. If the searched item is less than the middle item in the list, then the algorithm searches for the target in the first half, else, in the second half. This reduces the time complexity of the search.
Answer:
D- Trojan Horse
Explanation:
Trojan horse is a malware that has hidden code and look legitimate in order to damage or transfer harmful action on the computer.
Example hackers can disguise as Trojan horse by spying on the victims computer in order to gain access to sensitive data on the computer over the network.