Active learning: sizing a canvas box question 5

hello everyone
Iā€™m just stuck in this question

Blockquote

Change the line that calculates x so the box is 200px wide, but the 200 is calculated using the number 4 and an assignment operator.

Blockquote
any hint will be appreciate

Hello @ali_ibrahimi

Two things are important for question 5:

  • In line 1 ā€œxā€ gets the value ā€œ50ā€
  • Assignment operators are shortcuts. For example x += 5 means x = x + 5. If x was initially ā€œ10ā€ then after x += 5 the value of x would be ā€œ15ā€.

Tell me if you need more help.

Cheers,
Michael

2 Likes

Hello, @mikoMK thanks for your help. I think I got it. Sorry that Iā€™m responding too late, so I solve it by using x *= 4 which is the same as 4 * 50. Can you correct me please if I was wrong?

2 Likes

This is exactly the solution we were looking for. Good job! :+1:

2 Likes

Thank you so much for your assistance.*. @mikoMK :green_heart:

2 Likes