Ask coding questions

← Back to all posts
tainguyen3 (1)

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

Name the source code file "".

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

tainguyen3 (1)

I'm stuck on this an really need help

pyelias (2648)

What have you tried? What problems were there?

tainguyen3 (1)

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:
first = False
elif string[i] < minimum:
minimum = string[i]

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