This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
# build a 5x5 board of Os | |
board = [] | |
for x in range(5): | |
board.append(["O"] * 5) | |
def print_board(board): | |
for row in board: | |
print " ".join(row) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToRoman(num) { | |
let numeralString = []; | |
const numerals = [ | |
{'value': 1000, 'symbol': 'M'}, | |
{'value': 900, 'symbol': 'CM'}, | |
{'value': 500, 'symbol': 'D'}, | |
{'value': 400, 'symbol': 'CD'}, | |
{'value': 100, 'symbol': 'C'}, | |
{'value': 90, 'symbol': 'XC'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkCashRegister(price, cash, cid) { | |
let change = 0; | |
let cashInDrawer = getSumOfCID(cid); // total in drawer | |
let changeRequired = cash - price; // total to give back | |
// Can I make change? | |
if (changeRequired > cashInDrawer) { | |
change = {status: "INSUFFICIENT_FUNDS", change: []}; | |
} | |
else if (changeRequired == cashInDrawer) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calculator V2 | |
------------- | |
For FreeCodeCamp | |
A [Pen](https://codepen.io/loonylou/pen/XYJqza) by [Louise Quinn](https://codepen.io/loonylou) on [CodePen](https://codepen.io). | |
[License](https://codepen.io/loonylou/pen/XYJqza/license). |