generated from render-examples/fastapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
79 lines (69 loc) · 2.87 KB
/
index.html
File metadata and controls
79 lines (69 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="google-site-verification" content="aFn5C7ybPkOOcT1ymxpRGZ-J0aHOqjdFNcACj5poJb0" />
<title>Study Guide Creator</title>
<meta name="title" content="Study Guide Creator">
<meta name="description" content="This website helps you create study guides and test yourself. You input the questions & answers, then take the test and get an instant score."/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://raspberrypi400.github.io/study/"/>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="style1.css">
</head>
<body>
<main>
<h1>Study Guide Creator</h1>
<p>Press the <kbd>Enter</kbd> key to start the creator.</p>
<script>
window.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
startStudyGuideCreator();
}
});
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
function startStudyGuideCreator() {
let score = 0;
let numInput = prompt("How many questions would you like to have?");
if (numInput === null) return;
let numberOfQuestions = parseInt(numInput);
if (isNaN(numberOfQuestions) || numberOfQuestions <= 0) {
alert("Error. Please input a value above 0.");
return;
}
let questionAnswerPairs = [];
for (let i = 0; i < numberOfQuestions; i++) {
let question = prompt(`What should question ${i + 1} be?`);
let answer = prompt(`What should the answer be to question ${i + 1}?`);
questionAnswerPairs.push({ question, answer });
}
shuffle(questionAnswerPairs);
alert("Questions have been shuffled! Time to answer.");
for (let pair of questionAnswerPairs) {
let userAnswer = prompt(`${pair.question}\nYour answer:`);
if (userAnswer === pair.answer) {
alert("You got it correct!");
score++;
} else {
alert(`You got it wrong!\nThe correct answer is: ${pair.answer}`);
}
}
let questionWord = (score === 1) ? "question" : "questions";
alert(`You have answered ${score} ${questionWord} correctly.`);
console.log("Copyright (c) 2026 Elijah Corwin");
}
</script>
<footer>
<p><a href="https://github.com/RaspberryPi400/study" target="_blank" rel="noopener noreferrer">View the code behind it here</a></p>
<p><a href="https://raspberrypi400.github.io/my-projects/" target="_blank" rel="noopener noreferrer">View my other projects here</a>
<p>Copyright (c) 2026 Elijah Corwin</p>
<p>Contact me at <em>raspberrypi500@yahoo.com</em></p>
</footer>
</main>
</body>
</html>