Question

Program in IDLE: At a university, each student is assigned a system login name, which the...

Program in IDLE:

At a university, each student is assigned a system login name, which the student uses to log into the campus computer system. As part of your internship with the university's Information Technology department, you have been asked to 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 3 characters of the student's first name.

2) Get the first 2 characters of the student's last name.

3) Get the last four digits of the student's ID number For example, if a student's name is Amanda Spencer and her ID number is 2566721, her login name would be AmaSp6721. Write a program that asks the user for a first name, last name, and ID number, and then displays the login name.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python Code:

""" Python program that reads Name and ID and generates Login Name """

# Reading name from user
firstName = input("Enter your first name: ")
lastName = input("Enter your last name: ")
idNum = input("Enter your ID number: ")

# Validating invalid login names
try:
   # Forming login name
   loginName = firstName[:3] + lastName[:2] + idNum[len(idNum)-4:]
  
   # Printing result
   print(" Login Name: " + loginName)
  
except:   
   print(" Invalid entries!!! ")

____________________________________________________________________________________________________

Sample Run:

Add a comment
Know the answer?
Add Answer to:
Program in IDLE: At a university, each student is assigned a system login name, which the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT