unit 2 lab 4

i have to make a divisors block in which the block lists all the divisors of a number input using the keep block. my block keeps reporting back a blank list. here's what i have so far help plz lolScreen Shot 2020-10-13 at 5.35.44 PM

I'm guessing that there is an error in one of the inputs to the divisible by predicate.

Two problems here.

  1. What's the range of NUMBERS FROM? That is, what kind of thing does it report? What do you get when you use that as input to the LIST block?

  2. Look at the examples of KEEP in the lab. There's always an empty input slot in the predicate expression into which the items of the input list are inserted one at a time.

ok i changed it to this but it's still not right helpppScreen Shot 2020-10-14 at 8.21.11 PM

Okay, let's say you try DIVISORS OF 6. So you want to set your variable DIVISORS to all the possible divisors, namely the list (1 2 3 4 5 6). Is that what your SET does?

And, what are the questions you want KEEP to ask? I think they're
IS 6 DIVISIBLE BY 1?
IS 6 DIVISIBLE BY 2?
...
IS 6 DIVISIBLE BY 6?

Right? I see why you think that's what you're doing, because your KEEP predicate will only be called once, with 6 in the empty slot, because your DIVISORS list has only the one number 6 in it. But the two inputs to IS () DIVISIBLE BY ()? both have to be numbers. Is
NUMBERS FROM (1) TO (num)
a number?

ok, I get what I have to do, but how do i add each possible divisor of the input to the list separately? for example, if the input was 4, how would i add 1, 2, 3, and 4 into the list??

You don't want to do that! You're using KEEP to find all the divisors at once, starting with all the numbers from 1 to the input.

Do you understand what KEEP is all about?

hi i just figured it out myself thanks