Allena_Gorskaya

Programma 2

Mar 6th, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. # вторая программа
  2. from tkinter import *
  3. from random import *
  4. root = Tk()
  5.  
  6. for i in range(10):
  7.     for j in range(10):
  8.         x = randint(1, 100)
  9.         if x < 26:
  10.             square = Label(text = str((i+1) * (j+1)), bg = 'blue', width = 4)
  11.         elif x < 51:
  12.             square = Label(text = str((i+1) * (j+1)), bg = 'lightblue', width = 4)
  13.         elif x < 76:
  14.             square = Label(text = str((i+1) * (j+1)), bg = 'yellow', width = 4)
  15.         else:
  16.             square = Label(text = str((i+1) * (j+1)), bg = 'orange', width = 4)
  17.         square.grid(row = i, column = j)
  18.  
  19. root.mainloop()
Add Comment
Please, Sign In to add comment