Question

A persons initials consist of the first letter (in upper case) of each of their names. For example, the initials of Alan Mat

A person's initials consist of the first letter (in upper case) of each of their names. For example, the initials of Alan Mathison Turing are AMT.
Use loops to print out all possible initials for people who have exactly three names. Cycle through the letters of the first initial first, followed by the middle initial, and then the last initial.

Python Programming


A persons initials consist of the first letter (in upper case of each of their names. For example, the inters of Aan Mathiso
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Kindly Refer this modified code to show output exactly like expected output

Comments are written in code for better understanding.

alpha1 = 'A' #alpha1 is third initial
alpha2 = 'A' #alpha2 is second initial
alpha3 = 'A' #alpha3 is  first initial
for i in range(0, 26): #this for loop is for first initial going from A to Z
        for j in range(0,26):  #this for loop is for second initial going from A to Z... it is nested inside first for loop
                for k in range(0,26): #this for loop is for third initial going from A to Z... it is nested inside second for loop
                        print(alpha3,end="") #printing first initial... end ="" is used to print without space
                        print(alpha2,end="") #printing second initial...end ="" is used to print without space
                        print(alpha1)  #printing third initial... Next statement should be printed on new line so no end="" here
                        alpha3 = chr(ord(alpha3)+1)#ord convert char to integer then it is incremented and using chr it is converted to character again, so it will be holding next character
                alpha3 = 'A' # After completing third for loop third initial is given A value
                alpha2 = chr(ord(alpha2) + 1) #ord convert char to integer then it is incremented and using chr it is converted to character again, so it will be holding next character
        alpha2 = 'A' # After completing second for loop second initial is given A value           
        alpha1 = chr(ord(alpha1) + 1)  #ord convert char to integer then it is incremented and using chr it is converted to character again, so it will be holding next character

The output after executing code is:

AAA                                                                                                                                                

BAA                                                                                                                                                

CAA                                                                                                                                                

DAA                                                                                                                                                

EAA                                                                                                                                                

FAA                                                                                                                                                

GAA                                                                                                                                                

HAA                                                                                                                                                

IAA                                                                                                                                                

JAA                                                                                                                                                

KAA                                                                                                                                                

LAA                                                                                                                                                

MAA                                                                                                                                                

NAA                                                                                                                                                

OAA                                                                                                                                                

PAA                                                                                                                                                

QAA                                                                                                                                                

RAA                                                                                                                                                

SAA                                                                                                                                                

TAA                                                                                                                                                

UAA                                                                                                                                                

VAA                                                                                                                                                

WAA                                                                                                                                                

XAA                                                                                                                                                

YAA                                                                                                                                                

ZAA                                                                                                                                                

ABA                                                                                                                                                

BBA                                                                                                                                                

CBA                                                                                                                                                

DBA  

.....

Same previously uploaded code is modified.

It is just change in values of print , nothing else

I hope this will be fine

Add a comment
Know the answer?
Add Answer to:
A person's initials consist of the first letter (in upper case) of each of their names....
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
  • *****Requiremrnt: 1. Please do not use any array or arraylist 2. collects only a single String...

    *****Requiremrnt: 1. Please do not use any array or arraylist 2. collects only a single String input 3. uses at least 3 String methods 1) Just Initials: Print just the initials in upper case letters separated by periods 2) Last Name First With Middle Initial: Print the last name in lower case with the first letter capitalized, followed by a comma and the first name in in lower case with the first letter capitalized and then the middle initial capitalized...

  • C Program In this assignment you'll write a program that encrypts the alphabetic letters in a...

    C Program In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenère cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program must compile and run from the command line. The program executable must be named “vigenere” (all lower...

  • discrete math 1. Suppose that three friends, all heavy smokers, each have a 50-50 chance of...

    discrete math 1. Suppose that three friends, all heavy smokers, each have a 50-50 chance of developing lung cancer (a) Tracking whether each of the friends develops hung cancer, write down the sample space by listing its elements. Be clear about any notation that you choose to use. (b) What is the probability that exactly one of the friends develops lung cancer? (c) What is the probability that at least two of the friends develop lung cancer? 2. Six people...

  • Part 2: Drafting & Letter - Read the following case study carefully, and develop a document...

    Part 2: Drafting & Letter - Read the following case study carefully, and develop a document as required. Plan the content according to the principles covered in in the course (e.g., main idea first). Draft your document and proofread the text in detail. Give special attention to correct formatting, direct, positive, concise, and bias-free writing style. Check for grammar, punctuation, and spelling. Revise your document as thoroughly as possible. (30 points) You are part of a public relations department at...

  • Part 2: Drafting a Letter - Read the following case study carefully, and develop a document...

    Part 2: Drafting a Letter - Read the following case study carefully, and develop a document as required. Plan the content according to the principles covered in in the course (e.g., main idea first). Draft your document and proofread the text in detail. Give special attention to correct formatting, direct, positive, concise, and bias-free writing style. Check for grammar, punctuation, and spelling. Revise your document as thoroughly as possible. (30 points) You are part of a public relations department at...

  • Part 2: Drafting a Letter-Read the following case study carefully,and develop a document as required. Plan...

    Part 2: Drafting a Letter-Read the following case study carefully,and develop a document as required. Plan thecontent according to the principles coveredin in the course (e.g., main idea first). Draft your document and proofread the text in detail. Give special attention to correct formatting, direct, positive, concise, and bias-free writing style. Check for grammar, punctuation, and spelling. Revise your document as thoroughly as possible. (30points)You are part of a public relations department at a fast-growing consulting firm. You remember that...

  • C++ Programming Programming Project Outcomes:  Understand and use C++ functions for procedural abstraction and Functional...

    C++ Programming Programming Project Outcomes:  Understand and use C++ functions for procedural abstraction and Functional Decomposition  Develop some functions for generating numerical data from numerical inputs  Understand and utilize file input and file output to perform computing tasks Requirements: 1. You should do a functional decomposition to identify the functions that you will use in the program. These should include reading and writing the files, tallying and showing statistics, etc. 2. The program should prompt the user...

  • Item 1 In the case below, the original source material is given along with a sample...

    Item 1 In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button. Original Source Material Student Version In the 1986 soccer World Cup final, the Argentine star Diego Maradona did not score a goal but his passes through a ring of West German defenders led to two Argentine goals. The value of a star cannot be assessed only by looking at his...

  • What was Novartis ́ main challenge in managing talent in China? Novartis case . Global Talent...

    What was Novartis ́ main challenge in managing talent in China? Novartis case . Global Talent Management at Novartis I do not know how to post the PDF case? cloud you tell me how to give the case Sourcing Talent Globally The company was actively involved in sourcing talent from increasingly dispersed locations. Managers were encouraged to keep an updated list of leadership talent. In addition, the company 7 708-486 Global Talent Management at Novartis had recently expanded its hiring...

  • internal project 1 anything helps! thank you!! Instructions: Study the case that starts on page 3...

    internal project 1 anything helps! thank you!! Instructions: Study the case that starts on page 3 carefully. Then write concise answers to the following questions regarding the internal control system of Duarf, Inc. Clearly label your responses with proper headings and subheadings. Be very specific and precise. Answers that appear to be beating around the bush will not get any credit. 1. What are the controls in place that under normal conditions should function well to prevent embezzlements or frauds?...

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