TORONTO KIDS COMPUTER CLUB | Saturday 13:00 Python Practice – 23.04.15.
21988
post-template-default,single,single-post,postid-21988,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Saturday 13:00 Python Practice – 23.04.15.

19 Apr Saturday 13:00 Python Practice – 23.04.15.

Question:

Continue to program the code we made in the class at the bottom of this page. Try to use for loop to create buttons from 1-9.

Hint:
You can use “for i in range(1, 10):” or “for i in ‘123456789’:”  to build these 9 buttons, however, you should thinking of how to use math techniques to solve the row and column.

for example, buttons 1,2,3 are in row 3 and buttons 4,5,6 are in row 2. You should think that int(1/3) is 0 or 1//3 is 0,  2//3 is still 0, 3//3 is 1, 4//3 is 1, 5//3 is 1, 6//3 is 2. Then how can you make 1,2,3 all become 3, while 4,5,6 all become 2?

You should use %(finding division remainder) to solve columns, but how?

No Comments

Sorry, the comment form is closed at this time.