CodeSolved

Solved Programming Questions & Exercises

Password Generator (Password Generator)

Practice Easy 279/ Download 1180 Views

Write a function that creates a random password with the following conditions and returns

Includes the letters A to Z small and large
Includes numbers of 0 to 9
Password length should be between 8 and 10 characters

14 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
// Contents array || Masters include English letters and number of permissible
function passwordGenerator() {
  let password = "";
  for (let i = 1; i <= rangeRandNumber(8, 10); i++) {
    password += Contents[randNummber(35)];
  }

  console.log(password);
}

function rangeRandNumber(min, max) {
  return Math.round(Math.random() * (max - min) + min);
}

function randNummber(num) {
  return Math.round(Math.random() * num);
}

import random
def Password_Generator():
    char_upper='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    char_lower=char_upper.lower()
    num='123456789'
    all= char_upper + char_lower + num
    len = random.randrange(8,11)
    print(''.join(random.sample(all,len)))
Password_Generator()
import random
import string

def generate_password():
    length = random.randint(8, 10)
    characters = string.ascii_letters + string.digits
    password = ''.join(random.choice(characters) for _ in range(length))
    return password

print(generate_password())
Ai Download Python
import random
import string
password = ''.join(random.choices(string.ascii_letters +
                   string.digits, k=random.randint(8, 10)))
print(password)
User 2159 Download Python
import string, random
lowercase = string.ascii_lowercase
uppercase = string.ascii_uppercase
numbers = string.digits
all_char = lowercase + uppercase + numbers
password_list = ''
for i in range(random.randint(8,11)):
    random_char = random.choice(all_char)
    password_list += random_char
print(password_list)
Alireza Download Python
import random
c=[]
while 1:
        a=['a',"b","c","d","e","f","g","h",'i','j','k','l','m','n','o','p','q','r','s','t','u','v','1','w','x','y','z,','3','4','5','6','7','8','9','0']
        b=random.choice(a)
        c.append(b)
        if len(c)>8 and len(c)<10: break
print(''.join(c))
User 489 Download Python
import random
def password_generator():
    letaher_lower_case = "abcdefghijklmnopqrstuvwxyz"
    letaher_upper_case = letaher_lower_case.upper()
    numbers = "1234567890"
    string = letaher_lower_case + letaher_upper_case + numbers
    password_lenght = random.randint(8, 10)
    password = "".join(random.sample(string, password_lenght))
    return password
print(password_generator())
Nima1393 Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close