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
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...
Create a class called Student which stores • the name of the student • the grade...
Create a class called Student which stores • the name of the student • the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into the grade field. • Calculate the...
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...
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?
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...
Central University uses $123,000 of a particular toner cartridge for laser printers in the student computer...
Central University uses $123,000 of a particular toner cartridge for laser printers in the student computer labs each year. The purchasing director of the university estimates the ordering cost at $45 and thinks that the university can hold this type of inventory at an annual storage cost of 0.83 of the purchase price. The purchase price of each cartridge is $4.00/unit.   How many times per year should the purchasing director place an order to minimize the total annual cost of purchasing...
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?
Each student will be randomly assigned a microbial organism to research (see list below) and prepare...
Each student will be randomly assigned a microbial organism to research (see list below) and prepare at least one-half page of topic-related text detailing the organism genus/species name, biological classification (bacteria, archaea, fungi, protist), and five notable adaptive features or behaviors the organism possesses. Notable features may include physical structures, acquisition of nutrients, means of reproduction, relationships with other organisms. Briefly describe how each feature/behavior enables the organism to survive/thrive in its environment. Type the essay - written in your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT