Get the answers you need at Westonci.ca, where our expert community is dedicated to providing you with accurate information. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. 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. Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. Westonci.ca is committed to providing accurate answers. Come back soon for more trustworthy information.