Skip to content

Commit a2cacfe

Browse files
authored
Adding the option to start again
1 parent 6186369 commit a2cacfe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

PasswordGenerator

+14
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ def generatePassword(length, complexity):
9595
segmentsCount[pickSegment] -= 1
9696
newPassword = ''.join(newPassword)
9797
return newPassword
98+
99+
def startAgain():
100+
#a function for letting the user to start again the program.
101+
choice = input("\nStart again? (y/n): ")
102+
choice = choice.lower()
103+
if choice == 'y':
104+
main()
105+
elif choice == 'n':
106+
return
107+
else:
108+
print("Type y or n only please.")
109+
startAgain()
98110

99111
def main():
100112
print("Hello!")
@@ -106,4 +118,6 @@ def main():
106118
complexity = getComplexity()
107119
password = generatePassword(length, complexity)
108120
print(".\n.\n.\n.\n.\nYour password is: ", password)
121+
startAgain()
122+
109123
main()

0 commit comments

Comments
 (0)