SaudiPhilippines

All generations.

generate a big button that will link to https://www.thespruceeats.com/thmb/qvYHuvQdLuEaChTQXEFevyniJ2A=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/what-is-mutton-4846499-01-654cecf1a6ad4fa39d8ab247148ac266.jpg. the button should say "See mutton pics"

<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

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(""); }

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

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

O(n)

time complexityWed, 30 Nov 2022

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

O(n)

language from codeWed, 30 Nov 2022

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

Lua

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()

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()

generate functionWed, 30 Nov 2022

print a scary poem

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()

Javascript
View
translateWed, 30 Nov 2022

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

# using System; public class HelloWorld { static public void Main () { Console.WriteLine ("Hello Mono World"); } }

generate functionWed, 30 Nov 2022

ask about the first and last name

// 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();

Javascript
View
code to explanationWed, 30 Nov 2022

local function wait(seconds) local start = os.time() repeat until os.time() > start + seconds end io.write("This will break your device. Agree? [Y/N] ") local answer = io.read() if answer == "Y" then print("Downloading virus . . . 3%") wait(1) print("Downloading virus . . . 27%") wait(0.5) print("Downloading virus . . . 76%") wait(2) print("Downloading virus . . . 100%") wait(1) print("Downloaded virus successfully!") wait(1) print("Running virus . . .") wait(3) print("You got pranked! Hahaha!") wait(3) end if answer == "N" then print("Terminating program, please wait . . .") wait(5) print("Program terminated. You can now safely exit!") wait(999) end

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.

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()

## 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

Questions about programming?Chat with your personal AI assistant