Respuesta :
Answer:So my code manages to run every sample run correctly except for sample run 4 which has it as a decreasing array instead of an unsorted array:
Sample Run 1
How long do you want the array?
3
Enter a number
1.3
Enter a number
1.5
Enter a number
8.1
Your array is {1.3, 1.5, 8.1}
The average is 3.633333333333333
The range is 6.8
The array is sorted in increasing order
Sample Run 2
How long do you want the array?
-3
Not a valid length!
Sample Run 3
How long do you want the array?
2
Enter a number
3.6
Enter a number
0.8
Your array is {3.6, 0.8}
The average is 2.2
The range is 2.8
The array is sorted in decreasing order
Sample Run 4
How long do you want the array?
5
Enter a number
2.0
Enter a number
4.1
Enter a number
6.4
Enter a number
0.2
Enter a number
1.3
Your array is {2.0, 4.1, 6.4, 0.2, 1.3}
The average is 2.8
The range is 6.2
The array is unsorted
Explanation:
Answer:
This is the actual code
n = int(input("How many numbers do you need to check? "))
odd = 0
even = 0
for i in range(1, n+1):
num = int(input("Enter number: "))
if (num % 2 == 0):
print(str(num)+ " is an even number.")
even = even + 1
else:
print(str(num)+ " is an odd number.")
odd = odd + 1
print("You entered " + str(even)+ " even number(s).")
print("You entered "+ str(odd)+ " odd number(s).")
Explanation:
Can I please have brainliest?