The debugger is one of the tools I use the most. Use it to find out what each of your lines are doing.
The code from the video:
import random
import string
def generate_password(length):
characters = string.ascii_letters + string.digits + string.punctuation
password = ""
for i in range(length):
password += random.choice(characters)
return password
def main():
length = int(input("Enter the length of the password: "))
password = generate_password(length)
print(f"Generated Password: {password}")
if _name_ == "__main__":
main()