Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This was a real headscratcher but I finally got it.
The description for
div x, y
is "same with integer division" - integer being the key word we both missed.Where i was wrong?
Program is:
mov a, 11 ; value1
mov b, 3 ; value2
call mod_func
msg 'mod(', a, ', ', b, ') = ', d ; output
end
; Mod function
mod_func:
mov c, a ; temp1
div c, b
mul c, b
mov d, a ; temp2
sub d, c
ret
My output is 0, but should be 2. How i know i am right but i have error there
It is what?
What's wrong? It's working.
Yes, it is
You can do it better:
def prod(arr):
if arr:
return max(accumulate(arr, mul))
return 1
Silly me, I forgot it works both ways
You also can change number*-1 to -number