Skip to content

Commit 73c448f

Browse files
authored
Merge pull request #75 from denz647/main
Create guessmenumber.py
2 parents f677d94 + 965089f commit 73c448f

File tree

5 files changed

+83
-68
lines changed

5 files changed

+83
-68
lines changed

guessmenumber.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import random
2+
3+
def guess_number():
4+
target_number = random.randint(1, 100)
5+
attempts = 0
6+
7+
print("Welcome to the Number Guessing Game!")
8+
print("I've selected a random number between 1 and 100. Can you guess it?")
9+
10+
while True:
11+
guess = int(input("Enter your guess: "))
12+
attempts += 1
13+
14+
if guess < target_number:
15+
print("Too low! Try again.")
16+
elif guess > target_number:
17+
print("Too high! Try again.")
18+
else:
19+
print(f"Congratulations! You guessed the number {target_number} in {attempts} attempts.")
20+
break
21+
22+
if __name__ == "__main__":
23+
guess_number()

index.html

Lines changed: 0 additions & 68 deletions
This file was deleted.

password strength/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="styles.css">
7+
<title>Password Strength Checker</title>
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Password Strength Checker</h1>
12+
<input type="password" id="password" placeholder="Enter your password">
13+
<button onclick="checkPassword()">Check Strength</button>
14+
<p id="result"></p>
15+
</div>
16+
<script src="script.js"></script>
17+
</body>
18+
</html>

password strength/script.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function checkPassword() {
2+
var password = document.getElementById("password").value;
3+
var resultElement = document.getElementById("result");
4+
var strongRegex = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})");
5+
6+
if (password.match(strongRegex)) {
7+
resultElement.textContent = "Strong: Password is secure.";
8+
resultElement.className = "result-strong";
9+
} else {
10+
resultElement.textContent = "Weak: Password should contain at least one lowercase letter, one uppercase letter, one number, one special character, and be at least 8 characters long.";
11+
resultElement.className = "result-weak";
12+
}
13+
}

password strength/style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
body {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
height: 100vh;
6+
margin: 0;
7+
}
8+
9+
.container {
10+
text-align: center;
11+
}
12+
13+
input[type="password"] {
14+
padding: 10px;
15+
margin-bottom: 20px;
16+
}
17+
18+
button {
19+
padding: 10px 20px;
20+
cursor: pointer;
21+
}
22+
23+
.result-weak {
24+
color: red;
25+
}
26+
27+
.result-strong {
28+
color: green;
29+
}

0 commit comments

Comments
 (0)