0

How can Python compare two different solutions in a program and make it print out the best one (eg. the lowest price)?

Looking for ideas and tips

16th Sep 2019, 8:52 PM
W. Khalid
3 Réponses
+ 1
You can use the built-in function min: print(min(x, y)) Or you can define a new function: def s(x, y): if(x<y): return x return y
16th Sep 2019, 8:56 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
I don't understand your question, what do you mean exactly ?
16th Sep 2019, 8:53 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Let's say i have two different numbers infront of me. But i always want the system to choose the lowest number and print it out.
16th Sep 2019, 8:55 PM
W. Khalid