How to create an activation key in python

Viewed 40

I'm trying to create an activation key that if entered correctly, will carry on the python script, if entered incorrectly, it'll send the whole thing and have to rerun it all. This is what i've got so far:

activeKey = "ILoveCoding45"

enterActiveKey = input("Please enter the activation key down below:\n")
if activeKey == enterActiveKey:
    print("Activation key is successful.")
while activeKey != enterActiveKey:
    print("Activation key is incorrect. Please re-run the program")
    break

And either when it's entered correctly, the python script will keep running like normal, and i don't want that. Any bits of help would be great, thanks

1 Answers
activeKey = "ILoveCoding45"

while True:
    enterActiveKey = input("Please enter the activation key down below:\n")
    if activeKey == enterActiveKey:
        break
    print("Activation key is incorrect.")

print("Activation key is successful.")
code after success
Related