Question

In: Computer Science

At a university, students are assigned a system user name, which is used to log into...

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:

  1. 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.)

  2. 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)

  3. 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.)

  4. 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

Solutions

Expert Solution

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


Related Solutions

At a university, each student is assigned a system login name, which the student uses to...
At a university, each student is assigned a system login name, which the student uses to log into the campus computer system. Write the code that generates system login names for students. You will use the following algorithm to generate a login name: Get the first three characters of the student’s first name. (If the first name is less than three characters in length, use the entire first name.) Get the first three characters of the student’s last name. (If...
Create a system which ends when the user wants it to. After a user has used...
Create a system which ends when the user wants it to. After a user has used this system, there is an option of another user using it. The system should ask whether you want to continue or not. Below is a sample of the input/output system. Are you a student or a librarian? Hit 1 for student and 2 for librarian. $1 Enter Name: $William How many books do you want to take? $4 What books do you want to...
For each of the models below, provide me with: The functional form used (log-log, lin-lin, lin-log...
For each of the models below, provide me with: The functional form used (log-log, lin-lin, lin-log or log-lin) Where the coefficients in bold is an elasticity, a semi-elasticity or none of them The interpretation of the coefficient in bold, i.e. “if X (say the variable name) increases by 1 unit (or 1 %) then Y (say the variable name) increases (or decreases) by --- unit (or %)”.   Model 1: ln (YIELDi) = 0.56 + 0.76 x RAINFALL - 2.24 x...
A study is done to determine if students in the California state university system take longer...
A study is done to determine if students in the California state university system take longer to graduate, on average, than students enrolled in private universities. One hundred students from both the California state university system and private universities are surveyed. Suppose that from years of research, it is known that the population standard deviations are 1.5231 years and 1 year, respectively. The following data are collected. The California state university system students took on average 4.6 years with a...
Create a scenario on University management system that provides services to students and professors alike. and...
Create a scenario on University management system that provides services to students and professors alike. and prepare use case diagrams, sequence diagrams, activity diagram(s), and class diagrams for the system developing.
There was a certain class in which students had completed the work load assigned was very...
There was a certain class in which students had completed the work load assigned was very heavy. The instructor knew that the amount learned was directly related to that work load. The instructor surveyed 40 former students and asked if they would have been willing to actually learn less if that had meant less work. The instructor hoped that the ultimate goal of a student was to learn and so that less than 25 % of students would agree to...
Write a program called whilebun.py, in which the user is asked to guess the name of...
Write a program called whilebun.py, in which the user is asked to guess the name of your favorite DBVac vacuum cleaner model. Your program should: · Include a comment in the first line with your name. · Include comments describing each major section of code. · Set a variable called vacname to be equal to the name of your favorite DBVac vacuum cleaner model. · Ask the user to guess the name. Allow the user to make up to three...
Consider the following set of requirements for a university information system that is used to keep...
Consider the following set of requirements for a university information system that is used to keep track of students’ transcripts. R1: The university keeps track of each student's name, student number, class, and degree program. R2. The university consists of various departments. Each department is described by a name, department code and phone. R3. Each course has a course number, course name, and credits. R4. Each section has an instructor, course number, and section number. There might be multiple sections...
Prompt the user for their name, get and store the user input. Prompt the user for...
Prompt the user for their name, get and store the user input. Prompt the user for their age, get and store the user input. We will assume that the user will enter a positive integer and will do no error checking for valid input. Determine and store a movie ticket price based on the user's age. If their age is 12 or under, the ticket price is $5. If their age is between 13 and 64, inclusive, the ticket price...
A university system enrolling thousands of students needs to determine how many credit hours, on the...
A university system enrolling thousands of students needs to determine how many credit hours, on the average, each student takes per quarter. From previous studies, the population standard deviation is known to be 2.3 credit hours per quarter. Suppose the administration wanted to estimate the mean to within 0.1 hours with 95% confidence. How large a sample would they need to take?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT