Lesson 11: Conditionals 11.5


#1

So I’m ok with most every thing except 11.5, I can’t seem to solve it I have 2 trues, but the other 3 elude me. I know I’m just missing some little step.

// Modify these sprites so that all of the
// console.log() commands print true
var sprite1 = createSprite(100, 200);
sprite1.setAnimation(“apple”);
sprite1.rotation > 30;
sprite1.scale > 1.5;

var sprite2 = createSprite(300, 200);
sprite2.setAnimation(“carrot”);
sprite2.rotation < 60;
sprite2.scale > 0.5;

// Don’t edit the following (I’m serious!!!)
console.log("Comparison 1: " + (sprite2.x == sprite2.y));
console.log("Comparison 2: " + (sprite2.rotation < 40));
console.log("Comparison 3: " + (sprite1.scale == sprite2.scale));
console.log("Comparison 4: " + (sprite1.x > 150));
console.log("Comparison 5: " + (sprite2.y < 200));

drawSprites();

Comparison 1: false
Comparison 2: true
Comparison 3: true
Comparison 4: false
Comparison 5: false


#2

Hi George,

Here is the code I used to get all 5 trues:

// Modify these sprites so that all of the
// console.log() commands print true
var sprite1 = createSprite(160, 200);
sprite1.setAnimation(“apple”);
sprite1.rotation = 30;
sprite1.scale = 1.5;

var sprite2 = createSprite(150, 150);
sprite2.setAnimation(“carrot”);
sprite2.rotation = 35;
sprite2.scale = 1.5;

// Don’t edit the following (I’m serious!!!)
console.log("Comparison 1: " + (sprite2.x == sprite2.y));
console.log("Comparison 2: " + (sprite2.rotation < 40));
console.log("Comparison 3: " + (sprite1.scale == sprite2.scale));
console.log("Comparison 4: " + (sprite1.x > 150));
console.log("Comparison 5: " + (sprite2.y < 200));

drawSprites();


#3

Does anyone know if there is an “answer sheet” for teachers to see the solutions to all the lessons. This is my first year teaching this and was just looking for a little help.


#4

Steve,

As long as you are in the Teacher view you should have access to “Example Solutions” on the submit levels (in the right side pop out bar). Individual lessons don’t have answer sheets because there are often different ways to solve some of the problems. I approach this issue by telling students their first focus is to solve the problem and get code to successful run, then look over (often with a partner) and see if they could use fewer lines or less blocks. I focus on efficiency as the second step which often there is a more “correct” answer.

Hopefully that helps, let me know if you have further questions - or questions about individual non-submit bubbles!
Brad