the prompt is:
Write a Python program that prompts the user to enter his or her name and then creates a secret password consisting of three letters (in lowercase) randomly picked up from his or her name, and a random four-digit number. For example, if the user enters “Vassilis Bouras” a secret password can probably be one of “sar1359” or “vbs7281” or “bor1459”. Space characters are not allowed in the secret password. You will have to use string slicing, random, lower, and446670 concatenation.
my code is:
import random
name = input("Enter your name all lowercase ")
name2 = name.replace(" ", "")
letter1 = random.choice(name2)
letter2 = random.choice(name2)
letter3 = random.choice(name2)
letter4 = random.choice(name2)
passwordnumber = random.randint(0,9),random.randint(0,9),random.randint(0,9),random.randint(0,9)
passwordletter = (letter1+letter2+letter3+letter4)
password = passwordletter, passwordnumber
print(password)
Now I entered the name "nick g" into the program and got:
('nigc', (5, 4, 9, 6))
What I'm wondering is how can I make the output put the letters numbers together without spacing them out like this and putting parenthesis. any help is very appreciated thanks!
Aucun commentaire:
Enregistrer un commentaire