Answer: Sure, here's a Python program that reads in 10 integer numbers and performs the specified calculations:
Step-by-step explanation:
Python
Copy code
numbers = []
positive_count = 0
negative_count = 0
positive_sum = 0
negative_sum = 0
# read in 10 integer numbers
for i in range(10):
num = int(input("Enter an integer: "))
numbers.append(num)
# determine positive or negative and count
for num in numbers:
if num >= 0:
positive_count += 1
positive_sum += num
else:
negative_count += 1
negative_sum += num
# calculate sum and average
total_sum = sum(numbers)
average = total_sum / len(numbers)
# find largest and smallest numbers
largest = max(numbers)
smallest = min(numbers)
# output results
print("Positive count:", positive_count)
print("Negative count:", negative_count)
print("Positive sum:", positive_sum)
print("Negative sum:", negative_sum)
print("Total sum:", total_sum)
print("Average:", average)
print("Largest:", largest)
print("Smallest:", smallest)
In this program, we first create an empty list numbers to store the 10 integer numbers entered by the user. We then use a for loop to read in each number and append it to the list.
Next, we use another for loop to determine whether each number is positive or negative, and to count the number of positive and negative numbers. We also calculate the sum of positive and negative numbers separately.
After that, we calculate the total sum and average of all the numbers using the built-in sum and len functions. Finally, we find the largest and smallest numbers using the max and min functions.
Finally, we output all the results using print.
SPJ11