Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Number Guess by Bilou06
import random
def checkio(attempts):
for i in range(1,101):
if all( i%b==a for (a,b) in attempts if b!=0 ):
return [random.choice(list(set(range(2,11))-set([a for a,b in attempts]))),i]
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
checkio([(1,5)]) # the number has a remainder 1
checkio([(1,5),(1,2)]) # the number has a remainder 1
checkio([(1,5),(1,2),(2,3)]) # the number has a remainder 2
checkio([(1,5),(1,2),(2,3),(5,6)]) # the number has a remainder 5
checkio([(1,5),(1,2),(2,3),(5,6),(3,4)]) # the number has a remainder 3
Sept. 16, 2013
Comments: