Skip to content

Instantly share code, notes, and snippets.

View ByWaleed's full-sized avatar
⛏️
Building BBC iPlayer

Waleed Islam ByWaleed

⛏️
Building BBC iPlayer
View GitHub Profile
units = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
tens = ["", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"]
scales = ["", "thousand", "million", "billion", "trillion"]
def conver_number_to_word(number):
if number < 20:
return units[number]
elif number < 100:
unit = conver_number_to_word(number % 10)
if number % 10 == 0:
# Reversi (https://en.wikipedia.org/wiki/Reversi), also called Othello, is a game where each piece has two sides, black and white, and after being placed, further moves cause other pieces to flip tiles. Specifically, a line of pieces of one color gets flipped when they become surrounded by pieces of the opposite color on both ends.
# In this problem, we will be given a 2-dimensional array representing the board. Each position will contain a value of “B”, “W”, or “*” representing empty. Additionally, we get a position that is currently empty. Update the board to the new state after that play, including any flips if it is black’s turn to play. You can modify the existing array, but either way, return the board (2d array) with the new state.
# Follow-up:
# 1. Update this code to take a parameter of a “B” or “W,” indicating which player is making a move.
# EXAMPLE(S)
# For example, consider the row: