Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isValid(card):
- if type(card)==int:
- card=str(card)
- #s = sum(map(int,card[::-2]))
- # "789436574365873"
- s = 0
- for i in range(len(card)-1,-1,-2):
- s += int(card[i])
- for d in card[-2::-2]:
- d = int(d)*2
- s += d%10+1 if d > 9 else d
- return s%10 == 0
- def chess(bishop):
- board = [[0 for j in range(8)] for i in range(8)]
- a = 8
- #b5
- d = 8 - int(bishop[1])
- c = ord(bishop[0]) - ord('a')
- board[d][c] = 'B'
- x = c
- y = d
- while(x+1 <8 and y-1 >= 0):
- board[y-1][x+1] = '*'
- y-=1
- x+=1
- x = c
- y = d
- while(x-1 >= 0 and y+1 <8):
- board[y+1][x-1] = '*'
- y+=1
- x-=1
- for i in range (a):
- for j in range(a):
- print(board[i][j], end=' ')
- print()
- chess('f6')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement