PO8

plates.py

PO8
Nov 4th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. # https://www.reddit.com/r/FellowKids/comments/drbnxj/mathematics_meets_rfellowkids/
  4.  
  5. def is_pal(ds):
  6.     return ds[0] == ds[2]
  7.  
  8. def group(n):
  9.     for d1 in range(n):
  10.         for d2 in range(n):
  11.             for d3 in range(n):
  12.                 yield [d1, d2, d3]
  13.  
  14. n = 0
  15. for g1 in group(3):
  16.     for g2 in group(5):
  17.         if is_pal(g1) or is_pal(g2):
  18.             n += 1
  19.  
  20. print(n)
Add Comment
Please, Sign In to add comment