import random gs1 = input("choose a real number between 0 and 100, like 42.97531 or 3.1415926535. ") gs2 = (random.uniform(0.0, 100.0)) pre_average = (gs1 + gs) average = (pre_average / 2) tg1 = (average * 3) tg2 = (tg1 / 2) dif_bit_1 = (100 - gs1) dif_bit_2 = (100 - gs2) if (gs1 <= tg2): sc1 = (tg2 - gs1) elif (gs => tg2): sc1 = (gs1 - tg2) else: sc1 = tg2 if (gs2 <= tg2): sc2 = (tg2 - gs2) elif (gs => tg2): sc2 = (gs2 - tg2) else: sc2 = tg2 if (sc1 <= sc2): print("congratulations, you won!") else: print("you lose.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question