Search Header Logo
CMU CS Python Rectangles, Colors and borders.

CMU CS Python Rectangles, Colors and borders.

Assessment

Presentation

Computers

9th - 12th Grade

Easy

Created by

Maria Cruz Farooqi

Used 2+ times

FREE Resource

4 Slides • 11 Questions

1

CMU CS Academy

Replace this with a sub-header that can be in multiple lines. ​

Duplicate this text as many times as you would like.

2

The Canvas

To understand what is going on, we first have to talk about the canvas. In this course, all drawing is done on a canvas.

The canvas is made up of tiny colored points, or pixels. We use (x,y) coordinates to talk about pixels on the canvas, like so:

  • (0, 0) is the left-top corner of the canvas (not the middle!).

  • As x increases, you head right.

  • As y increases, you head down, not up!

  • Our canvas is a 400 x 400 square, so (200, 200) is the middle of the canvas, and (400, 400) is the right-bottom corner.


3

media
  • ​As x increases, you head right.

  • As y increases, you head down, not up!

  • Our canvas is a 400 x 400 square, so (200, 200) is the middle of the canvas, and (400, 400) is the right-bottom corner.

​(200, 200)

​(400, 400)

4

Multiple Choice

Question image

Which one is near (0, 0)\left(0,\ 0\right) ?

1

A

2

B

3

C

4

D

5

Multiple Choice

Question image

Which one is near (400, 0)\left(400,\ 0\right) ?

1

A

2

B

3

C

4

D

6

Multiple Choice

Question image

Which one is near (400, 200)\left(400,\ 200\right) ?

1

A

2

B

3

C

4

D

7

Multiple Choice

Question image

Which one is near (400, 400)\left(400,\ 400\right) ?

1

A

2

B

3

C

4

D

8

Python is very picky. Here are some rules to follow:

  1. Case matters, so Rect is not the same as rect.

  2. A command must have the right number of values after it.

    For Rect, that's left, top, width, and height. These values are called arguments. Here are some rules about arguments:

    • They must be in the right order.

    • They must be inside parentheses.

    • They must be separated by commas.

If any of these rules are not followed, you have an error, and your code will not run correctly until you fix the error.

9

Drag and Drop

Question image
Rect ( 50,  50,\ \ ​,​
, 150150 ,​
)
Drag these tiles and drop them in the correct blank above

10

Drag and Drop

Question image
Rect (​
,​
, 100100 , 200200 )

Rect (0,200,100,200)



Rect (200,200, 200,200)

Drag these tiles and drop them in the correct blank above

11

Drag and Drop

Question image
Rect(150, 150, 100, 100, fill​
)​
Drag these tiles and drop them in the correct blank above
= 'green'
: 'green'
= green
; "green"

12

Multiple Choice

Question image

The order in which we draw shapes matters. Each new shape is drawn on top of all the previous shapes. Which code is in the correct order?

1

Rect(0, 0, 100, 100, fill='orange')

Rect(50, 50, 100, 100, fill='lime')

2

Rect(50, 50, 100, 100, fill='lime')

Rect(0, 0, 100, 100, fill='orange')

13

Multiple Choice

Question image

The order in which we draw shapes matters. Each new shape is drawn on top of all the previous shapes. Which code is in the correct order?

1

Rect (40,20,160,160, fill="dodgerBlue")

Rect(120,100,160,200, fill="lightGreen")

Rect (200,220,160,160, fill="dodgerBlue")

Rect(0,0,400,400,fill="lightSalmon")

2

Rect(0,0,400,400,fill="lightSalmon")

Rect (40,20,160,160, fill="dodgerBlue")

Rect(120,100,160,200, fill="lightGreen")

Rect (200,220,160,160, fill="dodgerBlue")

14

Drag and Drop

Question image
Rect ( 50, 50, 100, 100, ​
'yellow' , ​ ​
'blue')
Drag these tiles and drop them in the correct blank above
fill =
border =
fill -
border -
fill :
border :

15

Dropdown

Question image
Rect (50,50,100,100, ​
, ​
​, ​
​ 12)

CMU CS Academy

Replace this with a sub-header that can be in multiple lines. ​

Duplicate this text as many times as you would like.

Show answer

Auto Play

Slide 1 / 15

SLIDE