python 2.7 - Adding the three highest numbers out of four randomly generated numbers -


i'm randomly generating 4 numbers. 4 numbers want take highest 3 , add them together.

using variables r1, r2, r3, , r4 how go doing this?

// in c++

   float f1 = 1, f2 = 2, f3 = 3, f4 = 4;    float sum = f1 + f2 + f3 + f4;    sum -= min(f1, min(f2,min(f3, f4);    cout << "answer = " << sum << endl; 

answer = 9


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -