# List input question

If I ask the following question:

Given {(3,2), (4,1), (5,9), (6,12), (7,12)} find the domain

is there a way to have students write the list of domain values into the input and have it checked for correctness, regardless of order?

I know I could simply do solution1=“3, 4, 5, 6, 7” but if they write it in any other order it would be wrong because it doesn’t match solution 1.

I was thinking maybe there was a way to set a variable equal to the amount that all the domain values add up to and when the list equals that amount it would be counted correct.

I think there are only two ways to submit a list, other than a full screen graph, and that is to use a table or individually submit numbers and use capture. The latter might be cumbersome for the student, so here’s an idea for using a table. There’s a new sort function for lists, so if you sort the correct domain and then sort the student’s submission, you can compare the lists to see if they match. You mentioned adding the domain values, but there’s a chance it could get marked correct while still being wrong (i.e. 5, 5, 5, 5, 5). Here’s an example of what I was thinking.

You could use countNumberUsage. First, checking for correct number of terms and then whether each value is present once.

``````d=input.latex
correct = countNumberUsage(d)=5 and countNumberUsage(d,3)=1 and countNumberUsage(d,4)=1... etc
``````

I am not seeing anything happen in the graph section

I wasnt able to figure out how to implement this.

This is what I came up with that does mostly what I was needing. The code is bulky though, but I wasnt sure how to better systemize the code.

Its the third slide that has the list domain activity

The graph doesn’t show anything. It’s only there to handle the list comparison, so you could just leave it blank or insert and image as a placeholder. Too see what’s actually being compared, open up the graph when editing.

1 Like

This was what I was thinking (Slide 4).

I see what you mean now. I like that. Thanks