Ask coding questions

← Back to all posts
Python
tainguyen3

Translate the following pseudocode for finding the minimum value from a set of inputs into a Python program.

Name the source code file "minimum.py".

Set a Boolean variable "first" to true.
While another value has been read successfully
If first is true
Set the minimum to the value.
Set first to false.
Else if the value is less than the minimum
Set the minimum to the value.
Print the minimum

Voters
glkemp01
tainguyen3
Comments
hotnewtop
tainguyen3

I'm stuck on this an really need help

pyelias

What have you tried? What problems were there?

tainguyen3

@pyelias
first = True
number=input("Please enter any numbers and -1 to finish:")

#Initialize first to true
i = 0

#Find the minimum value until sentinel is entered.
while i < len(string):
if first == True:
minimum=string[i]
first = False
elif string[i] < minimum:
minimum = string[i]
print(minimum)

So far i have this, but having problem write out the code.