var detonator = function (count) {
return function () {
if (count > 0) {
console.log(count + "...");
count--;
setTimeout(detonator(count), 1000);
} else {
console.log("BOOM!");
}
};
};
var bomb = detonator(3);
bomb();
if (EnemyNearby)
{
DoorClose();
}
function password(input) {
if (input === '12345') {
return "The password is correct"
} else {
return "The password is not correct"
}
}
password('12345')
function check_password(password) {
if (password === "1234567890") {
return "The password is correct.";
} else {
return "The password is incorrect.";
}
}
fix invalid codeSun, 19 Feb 2023
def countDown(time, alarm):
while time > 0:
time--
alarm()
def boom():
print("BOOM!")
countDown(5, boom)
bool enemyNearby;
void Update() {
if (enemyNearby) {
// Close the door.
}
}
var password = prompt("Enter the password:", "");
if (password == "rock") {
alert("Welcome!");
}
function warn(enemy) {
if (enemy === 'orc') {
return 'Orc detected. Closing doors.'
} else {
return 'No enemy detected.'
}
}
warn('orc');
import time
import os
def reminder(mins):
time.sleep(mins * 60)
os.system("say 'Your time is up!'")
fix invalid codeSun, 12 Feb 2023 .container {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
transition: all 0.3s;
...
}
.container:hover {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 1);
transform: translateY(-2px);
...
}
var text = document.getElementById("password")
var body = document.getElementById("body")
function checkPassword(){
if(text.value === "Hack"){
text.value = "The password is correct"
} else {
body.innerHTML = "The password is not correct"
}
}
<style>
body{background:red}
.container{
width:100%;
height:100%;
background:blue;
color:#fff
}
</style>
def countdown_timer():
timer = 10
while timer > 0:
print("Doom in: " + str(timer) + " seconds")
time.sleep(1)
timer -= 1
for _ in range(10):
print("BOOM!")
time.sleep(0.5)
print("The world is destroyed!")
exit()
countdown_timer()
function selfDestruction(lever, time, alarm){
if(time === 0){
return alarm
}else{
return "Please wait"+time
}
}
let input = Number(prompt("Please enter the password"));
function ab(){
if (input === 123) {
document.body.innerHTML = "the password is correct";
}
else{
document.body.innerHTML = "the password is not correct";
}
}
ab();
function password(prompt){
if (prompt == "123") {
console.log("the password is correct!")
}
else{
console.log("password incorrect!")
}
}
password("123")
const Html = (name, heigth, width, backgroundColor) => {
const html = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>${name}</title>
</head>
<body style="height:${heigth}px; width:${width}px; background-color:${backgroundColor};">
</body>
</html>`;
return html;
};
console.log(Html("abc", 100, 100, "red"));
function password(user){
if(user === '123456'){
return 'The password is incorrect.'
} else {
return 'The password is correct.'
}
}
password('123456')
def shutdown(seconds):
return seconds, "Seconds till Shutdown"
shutdown(5)
<!DOCTYPE html>
<html>
<head>
<title>Cool Website</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container" id="main">hello world</div>
</body>
</html>
public void DoorOpen()
{
if (enemyInRange)
{
CloseDoor();
}
else
{
OpenDoor();
}
}
python
class TestAdd(unittest.TestCase):
def test_add(self):
self.assertEqual(add(1, 2), 3)
function passCheck() {
var password = '1234'
var input = prompt('Enter password...')
if (input != password ){
document.write('Access Denied')
}
else {
document.write('Access Granted')
}
}
passCheck();
function tick() {
print("Tick")
sleep(1000)
tick()
}
function explosion() {
print("Boom!!")
}
function selfDestruct(timer) {
tick()
sleep(timer * 60 * 1000)
explosion()
}
selfDestruct(3)
import random
def shutdown(chance):
if chance > 1:
chance = chance / 100
random_num = random.random()
if random_num > chance:
print('shutdown succeed')
else:
print('shutdown failed')
shutdown(20)
function MinecraftLever() {
var time = 5; // set time in seconds
var alarm = 'creeper'; // set alarm to play
var lever = 1; // set lever to 1 for on and 0 for off
if (lever) {
if (time === 0) {
play(alarm);
}
time = time - 1;
}
}
import random
def override_shutdown(chance):
if chance > random.random():
print("Shutdown overridden!")
return True
else:
print("Shutdown failed!")
return False
override_shutdown(0.3)
function getPassword(password) {
if (password === "qwerty") {
return "пароль правильный";
} else {
return "пароль неправильный";
}
}
function myFunction(){
var userPassword = prompt("Enter password");
if(userPassword =="123"){
alert("The password is correct");
}else{
alert("The password is incorrect");
}
}
var password = prompt("Enter your password");
if (password == "123456") {
alert("The password is correct");
} else {
alert("The password is incorrect");
}
var password = prompt('Password plz:');
if (password == 'lala') {
alert('The password is correct.');
} else {
alert('The password is incorrect.');
}
function pass(a, b){
var a = "code";
if(a == "code"){
return "the password is correct";
}else{
return "the password is incorrect";
}
}
const password = "1234";
const userInput = prompt("Enter the password");
if (userInput === password) {
console.log("correct password")
} else {
console.log("incorrect password");
}
const password = prompt("Enter your password");
if (password === "1234567") {
alert("The password is correct.");
} else {
alert("The password is incorrect.");
}
fix invalid codeSun, 12 Feb 2023 ## License
[MIT](LICENSE.md)
function checkPassword(input) {
if (input === 'open sesame') {
alert('Success');
} else {
alert('Incorrect');
}
}
.cool-style {
background-color: #F7F7F7;
border-radius: 5px;
padding: 10px;
width: 400px;
height: 500px;
}
let password = prompt('what is your password');
if (password === '123456') {
alert('The password is correct.');
} else {
alert('The password is incorrect.');
}
const password = prompt("what is your password?");
if (password === '1234') {
alert('the password is correct');
} else {
alert('the password is incorrect');
}
Script
function selfDestructionWithTimer(selfDestructionTimer) {
const time = new Date().getTime() + (selfDestructionTimer * 1000);
function selfDestruction() {
const now = new Date().getTime();
if (now >= time) {
alert("boom");
} else {
setTimeout(selfDestruction, time - now)
}
}
selfDestruction()
}
var x = 5;
function alarm (x){
while (x<10){
x = x + 1;
console.log("Uhh, what?");
}
console.log("KABOOOOOM!!! :(");
}
def shutdown_or_not(chance):
if chance < 0.3:
return False
else:
return True
shutdown_or_not(0.4)
function boom(){
alert("now you're dead");
}
setTimeout(boom, 10000);
from random import randint
def chance():
return randint(0, 100)
def avert_shutdown(chance):
if chance >= 20:
return True
else:
return False
avert_shutdown(chance())
function guessPassword(password){
if(password === "123456"){
console.log("The password is correct")
}else {
console.log("The password is incorrect")
}
}
guessPassword("123456")
def shutdown_timer(time):
"""This function prints how much time you have left after you start the shutdown timer
"""
print("You have", time, "minutes left")
shutdown_timer(2)
function checkPassword(){
let password = prompt("please enter your password");
if(password === "123456"){
alert("the password is correct");
}else{
alert("the password is incorrect");
}
}
checkPassword()
def login_func():
password = input("Please enter password: ")
if password == "admin":
print("The password is correct")
else:
print("The password is incorrect")
login_func()
function checkPass(input) {
if (input.value == "123456") {
alert("the password is correct!")
} else {
alert("the password is not correct!")
document.body.innerHTML = "";
}
}
Script
function closeDoor() {
if (enemyNearby) {
print("Closing door")
closeDoor()
}
}
import random
def shutdown():
x = random.randint(1,100)
if (x >= 20):
print("Succeeded!")
return True
else:
print("Failed!")
return False
shutdown()
boolean doorOpen = true;
boolean enemyNearby = false;
if(enemyNearby) {
doorOpen = false;
System.out.println("Door closed!");
}
if(enemyClose == true){
door.close();
}
else{
door.open();
}
function validate_password(password) {
if (password == 'password') {
return "The password is correct.";
} else {
return "The password is incorrect.";
}
}
function selfDestruct(timer, alarm){
setTimeout(() => {
console.log(alarm)
}, timer);
}
selfDestruct(4000, "5...4...3...2...1...KABOOM!!!")
fix invalid codeSun, 12 Feb 2023 private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Enemy"))
{
Debug.Log("EnemyIn");
doorClose = true;
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Enemy"))
{
Debug.Log("EnemyOut");
doorClose = false;
}
}
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import os
root = Tk()
root.title("Shutdown App")
root.geometry("250x100")
def shutdown():
os.system("shutdown /s /t 1")
def cancel():
os.system("shutdown /a")
messagebox.showinfo("Shutdown Canceled", "Shutdown was canceled by the user")
button = ttk.Button(root, text="Shutdown", command=shutdown)
button.pack()
button2 = ttk.Button(root, text="Cancel", command=cancel)
button2.pack()
root.mainloop()
let password = "MyPassword";
const pass = prompt("Enter your password!", "");
if (pass == password) {
alert("The password is correct!");
} else {
alert("The password is incorrect!");
}
function explosion(timer, alarm) {
// code
// code
// code
return explosion;
}
explosion(10 second, "BOOM!");
import random
while True:
chance = input("Enter the chance: ")
if chance.isdigit() and 0 <= int(chance) <= 100:
break
if random.randint(1, 100) <= int(chance):
print("Shutting down")
else:
print("Error Overriding Shutdown")
from time import sleep
def timer(h, m, s):
print("Shutdown Timer Started... ")
counter = (h*3600) + (m*60) + s
for i in range(counter):
sleep(1)
counter -= 1
print(counter)
def show_timer(h, m, s):
if (m > 59):
print("Please enter a value less than 60 for minute")
elif (s > 59):
print("Please enter a value less than 60 for second")
else:
timer(h, m, s)
show_timer(0, 0, 1)
function getPassword() {
let password = prompt("Please enter your password: ");
if (password != "123") {
return "The password is incorrect.";
} else {
return "The password is correct.";
}
}
let password = prompt("Enter Password");
if (password == "helloworld") {
document.body.style.backgroundColor = "white";
} else {
document.body.style.backgroundColor = "black";
document.body.innerHTML = "The password is incorrect.";
}
fix invalid codeSun, 12 Feb 2023 ### 2.1.3 Markdown少量使用
Markdown少量用于注释,如下所示:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 100px;
height: 100px;
background-color: #a8b8d8;
}
.container:hover {
background-color: #ffa000;
}
.container > span {
display: inline-block;
padding: 10px;
background-color: #000;
color: #fff;
font-family: Arial, sans-serif;
border-radius: 0 0 5px 5px;
}
.container > span::before {
content: "";
position: absolute;
top: -20px;
left: 0;
width: 100%;
height: 20px;
background-color: #000;
border-radius: 5px 5px 0 0;
}
function sayHello(name){
return "Привет, " + name;
}
sayHello("Тимофей");
import random
def cancel_shutdown():
chance = random.randint(1,10)
if chance == 1:
print("Shutdown failed")
else:
print("Shutdown successful")
cancel_shutdown()
Script
function enemyNearby(detected) {
if (detected === true) {
return "Close the door!";
} else {
return "There is nothing to worry about.";
}
}
fix invalid codeSun, 12 Feb 2023
function checkPassword() {
var the_password = prompt("Enter the password.");
if (the_password == "password") {
alert("The password is correct.");
} else {
alert("The password is incorrect.")
}
}
function password(p) {
if (p === "12345") {
alert("The password is correct");
} else {
document.body.style.color = "black";
alert("The password is incorrect");
}
}
var p = prompt("Enter password");
password(p);
translateSun, 12 Feb 2023 function add(a, b) {
return a + b;
}
def add(a, b):
print(a + b)
add(1, 2)
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Enemy"))
{
Debug.Log("EnemyIn");
doorClose = true;
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Enemy"))
{
Debug.Log("EnemyOut");
doorClose = false;
}
}
translateSun, 12 Feb 2023 function add(a, b) {
return a + b;
}
function isCorrectPassword(input) {
const correctPassword = "12345";
if (input === correctPassword) {
return "The password is correct!";
} else {
return "The password is incorrect!";
}
}
fix invalid codeSun, 12 Feb 2023 .container {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
transition: all 0.3s;
...
}
.container:hover {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 1);
transform: translateY(-2px);
...
}
from random import random
def avetting_shutdown(chance):
if 0 < random() < chance:
return 'Shutdown successful!'
else:
return 'Shutdown failed!'
avetting_shutdown(0.7)
def countdown(t):
while t:
mins, secs = divmod(t, 60)
timeformat = '{:02d}:{:02d}'.format(mins, secs)
print(timeformat, end='\r')
time.sleep(1)
t -= 1
print('Goodbye!\n')
countdown(10)
.cool {
color: red;
font-size: 30px;
}
.container {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
transition: all 0.3s;
...
}
.container:hover {
...
box-shadow: 0 0 10px rgba(0, 0, 0, 1);
transform: translateY(-2px);
...
}
function password(x){
if (x = 'пароль'){
return 'привет';
} else {
return 'как стало так стало';
}
}
Script
function selfDestruct(timer) {
return console.log('boom')
}
setTimer(selfDestruct(5), 5000)
var input = prompt('enter password');
if(input === 'HongikUniv'){
alert('The password is correct')
}else{
alert('The password is incorrect')
}
function checkPassword(password) {
if (password == "12345") {
alert("The password is correct");
} else {
alert("The password is not correct");
}
}
let password = prompt("Please enter the password")
let allow = false
if (password === "correct password") {
allow = true
}
if (!allow) {
console.log("The password is incorrect")
} else {
console.log("The password is correct")
}
function checkPassword(password){
if (password !== 'codecademy'){
return 'Wrong password'
}
}
checkPassword('codecademy')
if (EnemyIsNearby)
{
CloseDoor();
}
function password(pass){
if(!pass) return 'The password is incorrect.';
return 'The password is correct.';
}
function selfDestruct(time, alarm) {
console.log("Boom");
console.log(alarm);
};
selfDestruct(10, "You've been blown up!");
public void controlDoor() {
if (!isDoorOpen && !isEnemyNear) {
openDoor();
} else if (!isDoorOpen && isEnemyNear) {
closeDoor();
}
}
const password = 'abcdef';
const password = 'abcd';
function checkPassword(password) {
if (password === 'abcdef') {
return true;
} else {
return false;
}
}
checkPassword(password);
const password = "Password";
let confirm = prompt("Please enter the password");
if (confirm != password) {
alert("The password is not correct");
} else {
alert("The password is correct");
}