In: Computer Science
At a university, students are assigned a system user name, which is used to log into the campus computer network system. As part of your internship with the university's IT department, your assignment is to write the code that generates system user names for students.
You will use the following logic to generate a user name:
Get the first three characters of the student's first name. (If the first name is less than three characters use the entire first name.)
Get the first three characters of the student's last name. (If the last name is less than three characters use the entire last name)
Get the last three characters of the student's ID number. (If the ID number is less than three characters, use the entire ID number.)
Concatenate the three sets of characters to generate the user name.
For example, if a student’s name is Yogi Bear, and his ID number is T0017258, his login name would be YogBear721.
In main, obtain the student’s first name, last name and ID number, then call a function named get_login_name that accepts the student's first name, last name, and ID number as arguments and returns the student's login name as a string.
Next, in main, ask the student to generate a password then call a function to verify that it is correct. Passwords must adhere to the following rules:
A valid password must be at least seven characters in length,
Must have at least one uppercase letter, one lowercase letter, and one digit.
python programme
SOURCE CODE (screenshot)


SOURCE CODE(copy - pastable)
def main():
#ask user for input
first_name = input("Enter First Name: ")
last_name = input("Enter Last Name: ")
ID = input("Enter ID: ")
#generate login name
login_name = get_login_id(first_name, last_name, ID)
#print the login name
print("Your login Name is: " + login_name)
#ask user to enter password
password = input("Enter password: ")
#check validity of password
if verify_password(password):
print("Password is Valid")
else:
print("password is invalid")
#generates login name
def get_login_id(first_name, last_name, ID):
return(first_name[:3] + last_name[:3] + ID[-3:])
#verifies password
def verify_password(password):
#set flags to fasle
capital_flag = False
small_flag = False
digit_flag =False
#check the existence of a lower case letter
for c in password:
if c.islower():
small_flag = True
#check the existence of an upper case letter
for c in password:
if c.isupper():
capital_flag = True
#check the existence of a digit
for c in password:
if c.isdigit():
digit_flag = True
#if all flags are true, return true
if small_flag and capital_flag and digit_flag:
return True
#else return fasle
return False
if __name__ == "__main__":
main()
OUTPUT


NOTE:
Please follow indentation acording to code screenshot