+ 2
hello everyone, help me I can't solve it.
How to do the maximum and minimum of the program. for example input 5 -> array input 2 1 3 5 8 in this set I will get the second value this 1
4 Respostas
+ 4
I have an example here which will help you get started.
It uses a random number generator, then inserts those numbers into a list whose size has been determined by your input.
The code then prints the list,& prints the min of the list.
See if you can print the max of the list
from random import randint as r
list_size = int(input())
lst = []
for i in range(list_size):
lst.append(r(1,9))
print(lst)
print(f'smallest number -> {min(lst)}')
+ 3
Rik Wittkopp thanks 😊
+ 2
https://www.sololearn.com/discuss/2536363/?ref=app
https://www.sololearn.com/discuss/2353396/?ref=app
https://www.sololearn.com/discuss/2616619/?ref=app
https://www.sololearn.com/discuss/851933/?ref=app
https://www.sololearn.com/discuss/1695960/?ref=app
https://www.sololearn.com/discuss/1621195/?ref=app
https://www.sololearn.com/discuss/1265007/?ref=app
https://www.sololearn.com/discuss/263747/?ref=app
+ 2
your_list = [2, 6, 8, 45, 6, 0, 3]
#smallest number in the list :
print(min(your_list))
#largest number in the list :
print(max(your_list))