This file contains 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 getUserChoice() { | |
userInput = prompt("enter your choice? "); | |
userInput = userInput.toLowerCase(); | |
if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') { | |
return userInput; | |
} else if (userInput === 'bomb') { | |
console.log('you won!'); | |
} else { | |
console.log('Error!'); | |
} |
This file contains 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
class BankAccount(object): | |
balance = 0 | |
def __init__(self, name): | |
self.name = name | |
def __repr__(self): | |
return "%s's account. Balance: $%.2f" % (self.name, self.balance) | |
def show_balance(self): | |
print "Balance: $%.2f" % (self.balance) | |
def deposit(self, amount): |