Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # https://www.reddit.com/r/FellowKids/comments/drbnxj/mathematics_meets_rfellowkids/
- def is_pal(ds):
- return ds[0] == ds[2]
- def group(n):
- for d1 in range(n):
- for d2 in range(n):
- for d3 in range(n):
- yield [d1, d2, d3]
- n = 0
- for g1 in group(3):
- for g2 in group(5):
- if is_pal(g1) or is_pal(g2):
- n += 1
- print(n)
Add Comment
Please, Sign In to add comment