Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 9th, 2012  |  syntax: None  |  size: 0.48 KB  |  views: 766  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import math
  2. user = 0;
  3. result = 50;
  4. num = 1;
  5. print ("Type 'h' for higher and 'l' for lower and 'r' if I'm right");
  6. print ("I'm ready to play!");
  7. while 1 == 1:
  8.  
  9.         print (result);
  10.         user = input("Higher (h), Lower (l) or Right (r)?");
  11.         if user == "h":
  12.                 result = math.ceil(result * (50 / num / 100 + 1));
  13.         elif user == "l":
  14.                 result = math.floor(result * (1 - 50 / num / 100));            
  15.         elif user == "r":
  16.                 break;
  17.         num = num + 1;
  18. print ("Number found in %d tries, not bad!" %(num));
clone this paste RAW Paste Data