We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 82b78cb commit b1e666eCopy full SHA for b1e666e
2 files changed
real-world-examples/generate_otp.py
@@ -0,0 +1,11 @@
1
+# Generate 6 digit OTP
2
+import string
3
+import secrets
4
+
5
+number = string.digits
6
+otp = ''
7
8
+for i in range (6):
9
+ otp += ''.join(secrets.choice(number))
10
11
+print(otp)
real-world-examples/generate_password.py
@@ -0,0 +1,20 @@
+letters = string.ascii_letters
+digits = string.digits
+special_chars = string.punctuation
+# Alphabet is the combination of letters, digits and special characters
+alphabet = letters + digits + special_chars
+# define password length
12
+password_len = 12
13
14
+password = ''
15
16
+for i in range(password_len):
17
+ password += ''.join(secrets.choice(alphabet))
18
19
+print(f"Password is: {password}")
20
0 commit comments