TORONTO KIDS COMPUTER CLUB | Aurora Monday 18:30 Python Homework 21.10.04.
post-template-default,single,single-post,postid-19963,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Aurora Monday 18:30 Python Homework 21.10.04.

09 Oct Aurora Monday 18:30 Python Homework 21.10.04.


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, so the tkinter window would display as below:

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.