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 removeVowels(sentence) { | |
var vowels = ['a', 'e', 'i', 'o', 'u']; | |
var newSentence = []; | |
for (var i = 0; i < sentence.length; i++) { | |
if (vowels.includes(sentence[i])) { | |
newSentence.push('-'); | |
} else { | |
newSentence.push(sentence[i]); | |
} | |
} |
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 toRoman(num) { | |
var decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; | |
var roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]; | |
var result = ''; | |
for (var i = 0; i <= decimal.length; i++) {//look up the array decimal for values | |
//looping over every element of arrays | |
while (num % decimal[i] < num) { | |
//keep trying the same number until we need to move to a smaller one | |
result =result+ roman[i]; |
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
<!--CAll to action--> | |
<div class="container text-center " id="background-call-action"> | |
<h3 style="color: white">Get our daily food items delivered to your email</h3> | |
<form action="" class="form-inline"> | |
<div class="form-group"> | |
<input type="text" class="form-control" id="subscription" placeholder="Your email"></input> | |
<button type="submit" class="btn btn-default">Subscribe</button> | |
</div> | |
</form> | |
</div> |
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
<div class="col-md-10"> | |
<div class="content"> | |
<!-- add a form--> | |
<form id="pingPongForm"> | |
<h1>Let's play!</h1> | |
<h2>Rules!</h2> | |
<p>PingPong will count your number with the following exceptions</p> | |
<ol> | |
<li>Numbers divisible by 3 becomes "ping"</li> | |
<li>Numbers divisible by 5 becomes "pong"</li> |
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
//user | |
$(document).ready(function() { | |
$("form#pingPongForm").submit(function(event) { | |
$("#userOutput").empty(); | |
var userInput = parseInt($("input#number").val()); | |
var result = pingPongFun(userInput); | |
result.forEach(function(output) { | |
$("#userOutput").append("<li>" + output + "</li>"); | |
event.preventDefault(); | |
}); |
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
'use strict' | |
const express = require('express') | |
const bodyParser =require('request') | |
const app =express() | |
app.set('port',(process.env.PORT || 5000)) | |
// Allows us to process the data | |
app.use(bodyParser.urlencoded({extend:false})) |
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
def calculate_tax(people): | |
while True: | |
try: | |
iterating_people = people.keys() | |
for key in iterating_people: | |
earning = people[key] | |
if earning <= 1000: | |
people[key] = 0 | |
elif earning in range(1001,10001): | |
tax1 = 0 * 1000 |
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: | |
def withdraw(self): | |
return | |
def deposit(self): | |
return | |
class SavingsAccount(BankAccount): |
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
def manipulate_data(data): | |
if isinstance(data, list): | |
return [sum(1 for n in data if isinstance(n, int) and n >= 0), | |
sum(n for n in data if isinstance(n, int) and n < 0)] | |
else: | |
return 'Only lists allowed' |
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
def binary_converter(dec): | |
if dec < 0 or dec > 255: | |
return "Invalid input"; | |
return "{0:b}".format(dec) |
OlderNewer