<!DOCTYPE html>
<html>
<head>
<style>
#demo {
background-color: LimeGreen;
color: black;
}
</style>
</head>
<body>
<button onclick="HideMe('The deadline is August 4th')">Try it</button>
<p id="demo"></p>
<script>
//javascript function
function HideMe(sentence) {
var flag = true;
//if soen287 is NOT found, -1 is returned.
if (sentence.toLowerCase().indexOf('soen287') !=-1)
{
//replacing soen287 with XXXXXXX
sentence = sentence.replace("soen287", "XXXXXXX");
flag = false;
}
//if summer is NOT found, -1 is returned.
if(sentence.toLowerCase().indexOf('summer') !=-1)
{
sentence = sentence.replace("summer", "XXXXX");
flag = false;
}
//if 19 is NOT found, -1 is returned.
if(sentence.toLowerCase().indexOf('19') !=-1)
{
sentence = sentence.replace("19", "XX");
flag = false;
}
var y = new Boolean(true);
if(flag == y)
{
document.getElementById("demo").innerHTML =sentence;
}else
{
document.write(sentence)
}
}
</script>
</body>
</html>
Output:
Question #4 Write a JavaScript function HideMe() that takes a user specified sentence and hides a...
CODE: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the word if it is part of a larger word. For example,...
PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the...
LANGUAGE = C i. Write a program that takes int numbers from user until user gives a sentinel value (loop terminating condition). Sort the numbers in ascending order using Insertion sort method. Sorting part should be done in different function named insertionSort(). Your code should count the number of swaps required to sort the numbers. Print the sorted list and total number of swaps that was required to sort those numbers. (4 marks) ii. In this part take another number...