How to find the lar…
 
Notifications
Clear all

How to find the largest and smallest number in an array?

1 Posts
2 Users
0 Likes
532 Views
0
Topic starter

How to find the largest and smallest number in an array?

1 Answer
0

Here is an example of how to find the largest and smallest number in an array in Python:

numbers = [3, 8, 2, 5, 1, 9]

largest = max(numbers)
smallest = min(numbers)

print("The largest number is:", largest)
print("The smallest number is:", smallest)
Share: