Locomotive_Engineer

Dear Colin,

thanks for that
I just had a look at it and saw that the function calls and hints were updatedt.

Yes, that’s what I’m used to
But how can I “focus on using the new information” if something crucial (Comprehension) is missing (here in the exercise “mixed Juices”)?

At the moment I cannot figure out at one glance what concept an exercise is related to or which exercises belong to a concept.

I Isaac

thanks for your answer
Is it really like that?

I think I saw recommended exercises before…
and now I don’t.
maybe because one exercise is “in-progress”??

And, can I reset an already started exercise [quote="AnandNisang, "]
“in-progress”
[/quote]
??

Thanks for answers

Nisang

You cannot mark a single exercise as not-started. You can reset the entire track, but not the status of one exercise.

Comprehensions are not crucial to the exercise, nor is map() nor broadcasting. Almost anything you can do with those, you can do with a for loop. These are just other ways of doing the same thing, which some students may want to try.

For example, the following are equivalent:

notacomp = []
for pair in iter
    push!(notacomp, last(pair))
end

acomp = [last(pair) for pair in iter]

And the following options will be equivalent if iter is a Vector (since they preserve the container):

abroadcast = last.(iter)
amap = map(pair -> last(pair), iter)
amap = map(last, iter)

If you don’t feel comfortable with these options, then there is always the for loop, but you can also do research into how to use any of them if you’d like, which is one reason we mention them. Otherwise you can continue in the syllabus and they will be covered in later concepts.

The exercises are meant to be self-contained, while keeping in mind that they come with prerequisites. Also, there are very often multiple ways of solving an exercise, and some students will prefer one method over another, so we try to give hints towards various options.

Instead of immediately trying to use everything, maybe a good technique for you to try at this stage would be to use basic functionality (e.g. for loops) to pass the tests, then try to refactor your code using alternatives that you have researched (e.g. map, comprehensions, etc). This is a good way to explore other options, but it requires curiosity and motivation to further explore a topic on your own because it is neither necessary nor expected.

Please read my last response before this one. It appears you are not using the syllabus on the Learn tab which I showed in a screenshot further above. This is where the concepts and concept exercises are organized together.

Okay,
I have to ask about this.
What are:

  • iter, does it refer to “Locomotive_Engineer”?
  • acomp
  • notacomp

That code shows two different ways to iterate over some iterable (iter), call last() on each value, and collect the result of that function call into an array/list/vector. One approach uses a compressive expression (acomp) and the other approach uses a loop, and not a comprehension expression (notacomp). Both accomplish the same thing.

1 Like

Exactly as @IsaacG said.

Also, in this case, you could use a dictionary from Locomotive Engineer as the iterable (iter) if you wanted and this code would give you its values.

If you want an iterable which will the same thing for all of the examples, you can use:

iter = [(1, 2), (3, 4), (5, 6)]