3
I’m stuck in this program, I can’t create a function in Python.
The exercise is as follows:
Write a function called buscarMenor() that takes a list of integers and returns the smallest of the elements. Also write the main program that passes the list to the function and displays the return. The search for the smallest element must be performed using a repetition structure, and the use of the min() function is prohibited. Example:
Entry: 7.0 5.5 6.0 9.0 Output: 5.5
What I’ve done so far:
listaInteiros = []
i = 0
while i < 4:
inteiros = int(input())
listaInteiros.append(inteiros)
i += 1
print(listaInteiros)
def buscarMenor():
I’m stuck in the function, give me a boost please!
According to the PEP8, function names should use Snake case (although there are several other ways to call it). Since you are learning, try already to follow the conventions. Your function
buscarMenor
should preferably be calledbuscar_menor
.– Renan Gomes