Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeafGrandma_DEFLEICE #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions deaf_grandma.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
function deafGrandma() {
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

console.log("HEY KID!");
let goodbye_count = 0;

rl.on('line', (response) => {
if (response === response.toUpperCase()) {
console.log("NO, NOT SINCE 1946!");
} else if (response === "") {
console.log("WHAT?!");
} else {
console.log("SPEAK UP, KID!");
}

if (response.toUpperCase() === "GOODBYE") {
goodbye_count += 1;
if (goodbye_count === 1) {
console.log("LEAVING SO SOON?");
} else if (goodbye_count === 2) {
console.log("LATER, SKATER!");
rl.close();
}
}
});


}

Expand Down
24 changes: 21 additions & 3 deletions deaf_grandma.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
def deaf_grandma():
import sys
print("HEY KID!")
goodbye_count=0

while True:
response = input()


deaf_grandma()
if response.isupper():
print("NO, NOT SINCE 1946!")
elif response == "":
print("WHAT?!")
else:
print("SPEAK UP, KID!")

if response.upper()=="GOODBYE":
goodbye_count+=1
if goodbye_count==1:
print("LEAVING SO SOON?")
if response.isupper()=="GOODBYE":
goodbye_count+=1
if goodbye_count==2:
print("LATER, SKATER!")
sys.exit()