Respuesta :
The answers to the programs that
- Accepts two numbers from the user and sums them up if neither are zero
- Accepts 50 grades and calculates their average
- Gets a number from the user and prints the sign of the number (that is, if the number is positive, negative or zero)
were written in Python 3.8, and can be found in the attached images
The first program uses a function get_input() to get the input for each number before they are added up. The function uses a while loop to make sure that the user does not enter zero.
Whenever the user enters zero, a message is displayed that says
"number should not be zero, Try again"
then the while loop repeats.
The next program uses a while loop and a variable named counter to keep track of the number of grades entered by the user.
Inside the loop, each time the user enters a number, it is added up to the previous sum, and the counter is incremented by one to keep track of the number of grades entered so far.
Once the loop completes, the average is then calculated from the accumulated sum. the average is computed by dividing that sum by the counter.
The third and final program uses an if statement to check the sign of the number entered by the user. Then it prints out an appropriate message.
The if statement tests for the conditions as follows
- If NUM > 0, then NUM entered was positive, and print "The number you entered is positive"
- else If NUM < 0, then NUM entered was negative, and print "The number you entered is negative"
- else NUM = 0, then NUM entered was zero, and print "You entered zero"
Another Python program about sums can be found here: https://brainly.com/question/6224293
![Ver imagen batolisis](https://us-static.z-dn.net/files/dcc/587ccc3e6b5e7cc753ae746f97e48476.png)
![Ver imagen batolisis](https://us-static.z-dn.net/files/df9/8eaf59c57fbc29771ac2630956d0090b.png)
![Ver imagen batolisis](https://us-static.z-dn.net/files/d16/293160cee81cf6b62d98bc44e4e4c086.png)