Jump to content

Number reversal game: Difference between revisions

Added 11l
(Added 11l)
Line 23:
*   [[Topswops]]
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V data = Array(‘139275486’)
V trials = 0
 
L data != sorted(data)
trials++
V flip = Int(input(‘###2: LIST: '#.' Flip how many?: ’.format(trials, data.join(‘ ’))))
data.reverse_range(0 .< flip)
 
print("\nYou took #. attempts to put the digits in order!".format(trials))</lang>
 
{{out}}
<pre>
# 1: LIST: '1 3 9 2 7 5 4 8 6' Flip how many?: 9
# 2: LIST: '6 8 4 5 7 2 9 3 1' Flip how many?: 6
# 3: LIST: '2 7 5 4 8 6 9 3 1' Flip how many?: 8
# 4: LIST: '3 9 6 8 4 5 7 2 1' Flip how many?: 7
# 5: LIST: '7 5 4 8 6 9 3 2 1' Flip how many?: 3
# 6: LIST: '4 5 7 8 6 9 3 2 1' Flip how many?: 6
# 7: LIST: '9 6 8 7 5 4 3 2 1' Flip how many?: 2
# 8: LIST: '6 9 8 7 5 4 3 2 1' Flip how many?: 4
# 9: LIST: '7 8 9 6 5 4 3 2 1' Flip how many?: 3
#10: LIST: '9 8 7 6 5 4 3 2 1' Flip how many?: 9
 
You took 10 attempts to put the digits in order!
</pre>
 
=={{header|Ada}}==
1,480

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.