Skip to content

Commit d3c9eca

Browse files
Update main.py
1 parent b8b91ee commit d3c9eca

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

main.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ def generate_password(length=100):
2626
return password
2727

2828

29-
# Generate a 100-character password
30-
print(COLORS['cyan'] + generate_password() + COLORS['reset'])
29+
try:
30+
# Generate a 100-character password
31+
print(COLORS['cyan'] + generate_password() + COLORS['reset'])
3132

32-
# Keep the script running
33-
while True:
34-
input("Press enter to generate a new password.")
35-
print(COLORS['cyan'] + generate_password() + COLORS['reset'])
33+
# Keep the script running
34+
while True:
35+
input("Press enter to generate a new password.")
36+
print(COLORS['cyan'] + generate_password() + COLORS['reset'])
37+
except KeyboardInterrupt:
38+
print("\n" + COLORS['red'] + "Generator Stopped" + COLORS['reset'])

0 commit comments

Comments
 (0)