#include <iostream>
using namespace std;
int main()
{
if(input.find("e") != std::string::npos)
cout << "Yay! This string has an 'e' in it" << endl;
}
Script
function death() {
alert("DEATH!!!");
}
#
function hasE(string) {
if (string.match(/e/gi)) {
alert("This string contains the letter 'e'!");
}
}
let translate = (string) => {
let split = string.split("");
for(var i = 0; i < split.length; i++) {
if(split[i] === "h") {
split[i] = "j";
}
if(split[i] === "i") {
split[i] = "o";
}
if(split[i] === "o") {
split[i] = "i";
}
if(split[i] === "j") {
split[i] = "h";
}
}
return split.join("");
}
This is a hello world program in C++ that prints "Hello world!" to the console.
fix invalid codeWed, 30 Nov 2022
val colors = arrayOf("Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet")
fun main(args: Array<String>) {
colors.shuffled().forEach {
println(it)
}
}
hasE_in <- function(str) {
if (str %in% strsplit(str, "")[[1]]) {
cat("\a")
}
}
hasE_in("Hello")
<a href="https://www.thespruceeats.com/thmb/qvYHuvQdLuEaChTQXEFevyniJ2A=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/what-is-mutton-4846499-01-654cecf1a6ad4fa39d8ab247148ac266.jpg"><button>See mutton pics</button></a>
fix invalid codeWed, 30 Nov 2022 fix invalid code:
let translate = (string) => {
let split = string.split("");
for(var i = 0; i < split.length; i++) {
if(split[i] === "h") {
split[i] = "j";
}
if(split[i] === "i") {
split[i] = "o";
}
if(split[i] === "o") {
split[i] = "i";
}
if(split[i] === "j") {
split[i] = "h";
}
}
return split.join("");
}
time complexityTue, 03 Jan 2023 O(n)
translateWed, 30 Nov 2022 def prsc():
print("Hello world!")
<p style="color: red">hello world</p>
fix invalid codeWed, 30 Nov 2022 // First and last name
function getFullName(firstName, lastName) {
return lastName + ", " + firstName;
}
getFullName("Kevin", "Gao");
const add = (a, b) => {
return a + b
}
add(1, 2)
/\w+ing$/
The function rainbow returns a list of colours. It prints each colour in the list.
function add(a, b) {
return a + b
}
add(1, 2)
<h1><u>TBA</u></h1>
function askAndAdd() {
var a = prompt("Enter first number");
var b = prompt("Enter second number");
var sum = a + b;
alert(sum);
}
public class Worth
{
public decimal netWorth { get; set; }
public decimal sinValue { get; set; }
public Worth(decimal netWorth, decimal sinValue)
{
this.netWorth = netWorth;
this.sinValue = sinValue;
}
}
fix invalid codeWed, 30 Nov 2022 def fullName(firstName, lastName):
alert(firstName + " " + lastName);
fullName(prompt("What is your first name?"), prompt("What is your last name?")
<button onclick="showNo()">Click for help</button>
<div id="no" style="display:none">No</div>
<script>
function showNo() {
document.getElementById("no").style.display = "block";
}
</script>
fix invalid codeWed, 30 Nov 2022 def random_string
a = ('a'..'z').to_a
a.shuffle![1..6].join
end
random_string()
<button id="btnChange" onclick="changefont()">Click for random font</button>
<script>
function changefont() {
var x = document.getElementById("btnChange");
x.innerHTML = Math.floor((Math.random() * 2) + 1);
}
</script>
fix invalid codeWed, 30 Nov 2022
code here
function hasE(str){
if(str.match(/e/)){
alert("that string has an e")
}
}
hasE("google")
<span style="text-shadow: 0px 0px 1px #0000ff, 0px 0px 2px #00ff00, 0px 0px 4px #0000ff, 0px 0px 6px #00ff00, 0px 0px 8px #0000ff, 0px 0px 10px #00ff00, 0px 0px 12px #0000ff, 0px 0px 14px #00ff00, 0px 0px 16px #0000ff; font-size: 30px;">Poikadot</span>
time complexityWed, 30 Nov 2022 O(n)
fix invalid codeTue, 03 Jan 2023 script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print("Human touched")
end
bool hasE(string s) {
return (s.find('e') != string::npos);
}
def rainbow():
colours = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for colour in colours:
print(colour)
rainbow()
<span style="color:red">Legilimens</span>
function add(a, b) {
return a + b;
}
add(1, 2);
<h1><u>TBA</u></h1>
translateWed, 30 Nov 2022 local function RandomNumber()
local rand = math.random(1, 500)
print(rand)
end
<audio src="http://www.moviesoundclips.net/download.php?id=46&ft=mp3" controls="controls" autobuffer="autobuffer" ></audio>
def robux(response):
if response == "Yes":
print("APRIL FOOLS!")
else:
print("You are wise!")
robux("Yes")
fix invalid codeWed, 30 Nov 2022
fix invalid codeWed, 30 Nov 2022 ## Run
<span class="glow">Sound</span>
<button style = "text-align: center; background: -webkit-linear-gradient(#f95a37, #f9b93b, #f95a37);"> Curious </button>
<h1 class="glow-purple">Creation</h1>
Lua
def dead():
print("YOU ARE DEAD")
<h1>TBA</h1>
function askName(firstName, lastName) {
const fullName = firstName + " " + lastName;
console.log(fullName);
}
askName("john", "doe")
<p style="color:red; font-weight:bold">Sectumsempra</p>
def get_user_input():
first_name = input('What is your first name? ')
last_name = input('What is your last name? ')
return first_name, last_name
get_user_input()
<h1 style="color:red;font-weight:bold">Sectumsempra</h1>
<button style="color:red">Hello!</button>
fix invalid codeWed, 30 Nov 2022 def get_user_input():
first_name = input('What is your first name? ')
last_name = input('What is your last name? ')
return first_name, last_name
get_user_input()
fix invalid codeWed, 30 Nov 2022 function scaryPoem() {
console.log("There was a young lady named Bright");
console.log("who travelled much faster than light");
console.log("She set out one day");
console.log("in a relative way");
console.log("and came back the previous night");
}
scaryPoem()
<a href="https://roblox.com/"><button>Open Roblox Website</button></a>
function fullName() {
var firstName = prompt("What is your first name?");
var lastName = prompt("What is your last name?");
alert(firstName + " " + lastName);
}
fullName();
<span style="font-weight: bold; color: rgb(255,0,0); text-shadow: rgb(255,0,0) 0px 0px 10px;">Sectumsempra</span>
function scaryPoem() {
console.log("There was a young lady named Bright");
console.log("who travelled much faster than light");
console.log("She set out one day");
console.log("in a relative way");
console.log("and came back the previous night");
}
scaryPoem()
The function add takes two arguments a and b and returns the sum of a and b.
translateWed, 30 Nov 2022 #
using System;
public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello Mono World");
}
}
fix invalid codeWed, 30 Nov 2022 ### fix invalid code
// First and last name
function getFullName() {
var firstName = prompt("What is your first name?");
var lastName = prompt("What is your last name?");
return firstName + " " + lastName;
}
getFullName();
def rainbow_colours
colours = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
colours.shuffle
end
rainbow_colours
fix invalid codeWed, 30 Nov 2022 ### Solution:
fix invalid codeWed, 30 Nov 2022 def random_string
a = ('a'..'z').to_a
a.shuffle![1..6].join
puts a
end
random_string()
This code prints out a fake virus downloader. It waits for the user to input a response, and if the response is 'Y', it prints out a fake virus downloader progress bar, and then 'You got pranked! Hahaha!". If the response is 'N', it exits the program.
<p style="font-size: 720px; color: linear-gradient(to right, yellow, orange, red, violet, blue, green);">Hello</p>
fix invalid codeWed, 30 Nov 2022 def rainbow():
colours = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for colour in colours:
print(colour)
import random
rainbow = ["red", "orange", "yellow", "green", "blue", "purple"]
random.shuffle(rainbow)
print(rainbow)
Prints Hello world to the screen.
class Worth:
def __init__(self, moral, sins):
self.moral = moral
self.sins = sins
<p style="color:red;font-weight:bold;">Sectumsempra</p>
<span style="color:red; font-weight:bold; text-shadow: 0 0 5px yellow;">Sectumsempra</span>
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" class="btn btn-primary btn-lg active">Open Death</a>
translateWed, 30 Nov 2022 def RandomNumber():
rand = math.random(1, 500)
print(rand)
<span style="text-shadow:2px 2px 2px purple;">Creation</span>
def has_e(str)
if str.include? "e"
puts "We have an e."
else
puts "No e here."
end
end
<h1>Lua Basics</h1>
<p>Lua is amazing!</p>
<h2>TBA</h2>
This function takes two arguments firstName and lastName and returns a string firstName, lastName.
fix invalid codeWed, 30 Nov 2022 ## Session 3: [selections](http://python-textbok.readthedocs.io/en/latest/Selection_Control_Flow.html)
### Read
* [Chapter 5: Selection Control Flow](http://python-textbok.readthedocs.io/en/latest/Selection_Control_Flow.html)
* [Chapter 6: Iteration Control Flow](http://python-textbok.readthedocs.io/en/latest/Iteration_Control_Flow.html)
* [Chapter 7: Functions](http://python-textbok.readthedocs.io/en/latest/Functions.html)
* [Chapter 8: Strings](http://python-textbok.readthedocs.io/en/latest/Strings.html)
* [Chapter 9: Lists and Tuples](http://python-textbok.readthedocs.io/en/latest/Lists_Tuples.html)
* [Chapter 10: Dictionaries](http://python-textbok.read
<p style="background: linear-gradient(to right, #ff0000, #ffa500, #ffff00, #008000, #0000ff, #4b0082, #ee82ee);">Hi!</p>
Script
function add(a, b){
return a + b;
}
const sum = add(1, 2);
<h1>Hi there 😊</h1>
<u>TBA</u>
func hasLetter(str: String) {
for letter in str.characters {
if letter == "e" {
print("This string has an e!")
}
}
}
hasLetter(str: "hello") // This string has an e!
def random_string
a = ('a'..'z').to_a
a.shuffle![1..6].join
end
random_string()
def has_e(st):
if 'e' in st:
print('yes')
else:
print('no')
has_e('hello')
has_e('world')
<span style="background: linear-gradient(45deg, #93a5cf, #e4efe9);
box-shadow: 0 0 5px #ccc,
inset 0 0 5px #ddd,
-webkit-background-clip: text,
-webkit-text-fill-color: transparent;">Poikadot</span>
The function death() alerts the user with the text "DEATH!!!"
def has_e(word):
for letter in word:
if letter == "e":
return True
return False
has_e("ninja")
<b> Chaos Knight </b>
fix invalid codeWed, 30 Nov 2022 ## License
Copyright (c) 2014 [Jinjiang](http://jinjiang.in).
Licensed under the MIT license.
<span style="color:purple">Creation</span>
<span style="color:red; font-weight:bold;">Sectumsempra</span>
<span style="color:purple;font-weight:bold;text-shadow:0 0 2em purple;">Gladio</span>
<table>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
<tr>
<td>d</td>
<td>e</td>
<td>f</td>
</tr>
<tr>
<td>g</td>
<td>h</td>
<td>i</td>
</tr>
<tr>
<td>j</td>
<td>k</td>
<td>l</td>
</tr>
<tr>
<td>m</td>
<td>n</td>
<td>o</td>
</tr>
</table>
<button onclick="window.open('http://www.google.com')">Open Google</button>
<span style='color: red;font-weight: bold;'>Sectumsempra</span>
explanation of the code:
def add(a, b):
return a + b