Question

In: Computer Science

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:

  1. 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.)
  2. Get the first three characters of the student’s last name. (If the last name is less than three characters in length, 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 in length, use the entire ID number.)
  4. Concatenate the three sets of characters to generate the login name.

For example, if a student’s name is Amanda Spencer, and her ID number is ENG6721, her login name would be AmaSpe721. You decide to write a function named get_login_namethat accepts a student’s first name, last name, and ID number as arguments, and returns the student’s login name as a string.

(ON PYTHON IDLE 3.7.2)

Solutions

Expert Solution


output:

  

source code:

def get_login_name(f_name,l_name,id_number):
   f_cal=len(f_name)
   l_cal=len(l_name)
   id_cal=len(id_number)
   k=" "
   if(f_cal<=3 and l_cal>3 and id_cal>3):
       k=f_name+l_name[0:3]+id_number[-3:]
   elif(f_cal>3 and l_cal<=3 and id_cal>3):
       k=f_name[0:3]+l_name+id_number[-3:]
   elif(f_cal>3 and l_cal>3 and id_cal<=3):
       k=f_name[0:3]+l_name[0:3]+id_number
   elif(f_cal<=3 and l_cal<=3 and id_cal>3):
       k=f_name+l_name+id_number[-3:]
   elif(f_cal>3 and l_cal<=3 and id_cal<=3):
       k=f_name[0:3]+l_name+id_number
   elif(f_cal<=3 and l_cal>3 and id_cal<=3):
       k=f_name+l_name[0:3]+id_number
   elif(f_cal<=3 and l_cal<=3 and id_cal<=3):
       k=f_name+l_name+id_number
   elif(f_cal>3 and l_cal>3 and id_cal>3):
       k=f_name[0:3]+l_name[0:3]+id_number[-3:]
   return k
f_name=input("Enter your first name")
l_name=input("Enter your first name")
id_number=input("Enter your first name")
login_name=get_login_name(f_name,l_name,id_number)
print(login_name)

if you have any doubts comment below.....


Related Solutions

A large University system, which currently uses a standard grading system of A, B, C, D...
A large University system, which currently uses a standard grading system of A, B, C, D or F for their students, is analyzing the possibility of changing to a plus-minus grading policy. In addition to the computer system, which stores and manages all the student records, the faculty and the students would also be affected by this possible change. One of the concerns that students have, is that changing this policy might lower the overall GPA (grade point average) of...
Vermeillen Corporation uses a standard costing system in which variable manufacturing overhead is assigned to production...
Vermeillen Corporation uses a standard costing system in which variable manufacturing overhead is assigned to production on the basis of the number of machine setups. The following data pertain to one month's operations: Variable manufacturing overhead cost incurred: $70,000 Total variable manufacturing overhead variance: $4,550 Favorable Standard machine setups allowed for actual production: 3,550 Actual machine setups incurred: 3,500 The standard variable overhead rate per machine setup is: Multiple Choice $18.44 $21.30 $21.00 $20.00
Phyton Login program To start the program each day the manager must login. The main (manager)...
Phyton Login program To start the program each day the manager must login. The main (manager) window will appear with a login, create password, and cancel button. A password must exist for the login button to be enabled. The password is created in a separate window and must be 9 characters or more, and it must have at least on digit, uppercase and lowercase letter. The program will continue to show error messages and prompt for a password until a...
Research Questions for Student Groups Each student group will be assigned one of the topics below...
Research Questions for Student Groups Each student group will be assigned one of the topics below to research in some detail and prepare a short, -minute PowerPoint presentation on it. Th ey will then use their PowerPoint presentation to explain the topic to their fellow students at the next class period. . Provide a brief overview of recombinant DNA technology. What are restriction enzymes? What are plasmids? . Who are Stanley Cohen and Herbert Boyer and what was their role...
C++ : Write a program that creates a login name for a user, given the user's...
C++ : Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first five letters of the last name, followed by the first letter of the first name, and then the last two digits of the number (use the % operator). If the last name has less than five letters, then use all letters of the...
Operating system: A CS student assigned to work on deadlocks thinks of the following way to...
Operating system: A CS student assigned to work on deadlocks thinks of the following way to eliminate deadlocks. When a process requests a resource , it specifies a time limit. if the process blocks because the resource is not available , a timer is started. If the time limit is exceeded, the process is released and allowed to run again. If you were the professor, what grade would you give this proposal and why?
A student uses n passwords, but forgets which one is for his email. If the student...
A student uses n passwords, but forgets which one is for his email. If the student tries the passwords at random (even multiple times in a row, suspecting a typo), what is the probability that the student will need exactly k tries to login? What if the student writes down tried passwords and doesn't reuse them?
Student Name:                                        &n
Student Name:                                                                                              Date: PROFESSIONAL ATTRIBUTES MOST VALUED BY EMPLOYERS Courtesy of National Association of Colleges and Employers (NACE) Instructions: Part I: Choose from the following list, five attributes (abilities) you already possess. Describe, in detail, how you demonstrated each of these attributes (abilities) in a real-life situation in either a school or work environment. List of attributes (abilities): Decision making/problem solving Verbal communication with both internal and external customers Obtaining and processing information Planning, organizing, and prioritizing work Analyzing quantitative...
The criminal justice system has three components. Name and define each of the components. Which one...
The criminal justice system has three components. Name and define each of the components. Which one is in need of the most comprehensive overall at this time in our history and why?
Scenario: You are the member of a student organization at Northeast State University which works to...
Scenario: You are the member of a student organization at Northeast State University which works to provide professional development opportunities for students. You saw an interesting article in a college magazine describing a “Suitable Suits” program another university implemented. Its career development office kept a closet with 21 crisp black suits of all sizes that students could borrow for job interviews. Students would make an appointment with the office and agree to dry clean the suits before returning them. The...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT