88.9k views
4 votes
write a program that first defines three string objects called firstName, middleName, and lastName which contains your own first, middle and last name separately. If you do not have middle name, then make up one. Then try to generate a new user name for you by using your first letter of your first name(captilized), first letter of you middle name (Captilized), plus all letters in your last name, add a random number between (1 to 100) to the your new user name. Here is an exampl: Name: John blake adams then the user name generated by your program coulde be: JBadams23

User Heba
by
5.5k points

1 Answer

3 votes

Answer:

Written in Python

import random

firstName = "Charles"

lastName = "Dawson"

middleName = "Rutherford"

pwd = firstName[0] + lastName[0]+middleName+str(random.randint(1,101))

print(pwd)

Step-by-step explanation:

This line imports random library into the program

import random

The next three lines initializes the name of the user

firstName = "Charles"

lastName = "Dawson"

middleName = "Rutherford"

This line generates the password

pwd = firstName[0] + lastName[0]+middleName+str(random.randint(1,101))

This line prints the generated password

print(pwd)

User Krakover
by
4.9k points