forked from skuppens/Make1.2.3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandom Wachtwoord.py
More file actions
97 lines (68 loc) · 2.82 KB
/
Random Wachtwoord.py
File metadata and controls
97 lines (68 loc) · 2.82 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
"""
Een python script dat random wachtwoorden genereert.
zowel kleine letters als grote, cijfers en tekens
op aanvraag de complexiteit (aantal tekens en soort tekens)
maak gebruik van flowcontrol en functies!
"""
# IMPORTS #
import random
import time
# AUTHOR INFORMATION #
# _____
# .' `.
# / .-=-. \ \ __
# | ( C\ \ \_.'')
# _\ `--' |,' _/
# /__`.____.'__.-' The coding snail~
__author__ = "Kevin Vervloet"
__email__ = "kevin.vervloet@student.kdg.be"
__Version__ = "(Code version)"
__status__ = "Finished"
# VARIABLES #
# MAIN CODE #
# def error():
def high_security():
""" High security password code"""
print("==You picked high security==")
time.sleep(0.5)
lenght = int(input("How long do you want your password to be?: "))
characters_high = list('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*(){}[]<>,.')
password_random_characters = [random.choice(characters_high) for i in range(lenght)]
password = "".join(password_random_characters)
print("This is your random password", password)
def medium_security():
""" Medium security password code"""
print("==You picked medium security==")
time.sleep(0.5)
lenght = int(input("How long do you want your password to be?: "))
characters_medium = list('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
password_random_characters = [random.choice(characters_medium) for i in range(lenght)]
password = "".join(password_random_characters)
print("This is your random password", password)
def low_security():
""" Low security password code"""
print("==You picked low security==")
time.sleep(0.5)
lenght = int(input("How long do you want your password to be?: "))
characters_low = list('abcdefghijklmnopqrstuvwxyz1234567890')
password_random_characters = [random.choice(characters_low) for i in range(lenght)] # picks random characters
password = "".join(password_random_characters)
print("This is your random password", password)
def main():
what = input("""How strong do you want your password to be?
a = low (only small letters & numbers)
b = medium (small letters, numbers & capital letters)
c = high (small letters, capital letters, numbers & symbols\n """) # Input question
if what == "a":
low_security()
elif what == "b":
medium_security()
elif what == "c":
high_security()
elif what != "a" or "b" or "c": # if the input is wrong restart the program
print("not a valid option, please try again")
time.sleep(0.5)
main()
if __name__ == '__main__': # run tests if called from command-line
main()