Skip to content
Advertisement

Building a password generator

I have recently built a password generator but wanted to include an aspect where if the user types in a letter instead of a number when defining the length of the password and number of passwords then the output would be to loop back in. If not the password generator would continue if numbers were inputted.

This is my code so far:

JavaScript

Advertisement

Answer

Python offers a better way to check if a string is a digit or not.

From w3:

The isdigit() method returns True if all the characters are digits, otherwise False.

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement