At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

It requires input from a user to populate a list with three values and it's coming up wrong every time. Some values are correct and others are incorrect like [7,15,3] when called in by user it's wrong and selects 15.The goal is to display the minimum


input output right facing arrow * ##

#my_list = [7,17,10]

my_lista = [ ]


n = input( )

my_lista.append(n)

# second Value in list


n1 = input()

my_lista.append(n1)


# third value in list

n2 = input()

my_lista.append(n2)


min_num = min(my_lista)


print(min_num)


Sagot :

Answer:

I'm pretty sure the problem is that you're prompting the user to input a string value instead of an int value. This can be done by putting int() before input()

To clean it up your way, try doing:

my_lista = []

n = int(input())

my_lista.append(n)

n1 = int(input())

my_lista.append(n1)

n2 = int(input())

my_lista.append(n2)

min_num = min(my_lista)

print(min_num)

If you want to shorten the code, you can also do it this way which gives you the same output:

my_list = []

for i in range(3):

    n = int(input())

    my_list.append(n)

print(min(my_list))

We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.