Answer:
Decorators are very powerful and useful tool in Python since it allows programmers to modify the behavior of function or class. Decorators allow us to wrap another function in order to extend the behavior of wrapped function, without permanently modifying it.
Explanation:
Answer: there is an overflow
Explanation:
Here using 4-bit signed fields to store the addition value.
0111 + 0101 = 1100
In above addition the MSB is reserved for sign.
If MSB is 0 means the number is positive.
If MSB is 1 means the number is negative.
The first number 0111 has MSB 0 means it is a positive number.
The second number 0101 has MSB 0 means it is also a positive number.
But after addition the result obtained is 1100 which MSB is 1 indicating the
result is negative number.
How can it be possible to add two positive numbers and get a negative number as result.
This type of situation is called overflow situation.
It is used for error detection purpose.
therefore there is an overflow
Hi I hope this helps. The answer is host.
Answer:
Following are the program in the Python Programming Language.
#declare variables and initialize to 0
s=0
n=0
avg=0
#set the infinite while loop
while(True):
#get input from the user
score=input()
#set if statement to break loop
if(score =="stop"):
break
#otherwise, perform calculation
else:
n+= 1
s=s+ int(score)
avg= s/n
#print average of the input
print ('average: ',avg)
<u>Output</u>:
58
96
34
15
stop
average: 50.75
Explanation:
<u>Following are the description of the program</u>.
- Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
- Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
- Finally, we print the result with message.