Number reversal game: Difference between revisions

Content added Content deleted
Line 108: Line 108:
random.shuffle data
random.shuffle data
while data != sorted(data):
while data != sorted(data):
trials += 1
trials += 1
flip = int input '#$trials: LIST: $(join data) Flip how many?: '
flip = int input '#$trials: LIST: $(join data) Flip how many?: '
data[:flip] = data[!flip:]
data[:flip] = data[!flip:]


print '\nYou took $trials attempts to put digits in order!'</lang>
print '\nYou took $trials attempts to put digits in order!'</lang>