asked 198k views
2 votes
You are provided a variable called NameList that contains every letter of the alphabet. Spell your first and last name using that NameList variable. Please do not forget spaces and capitalization.

There is an example of what is expected on the last line:

NameList =
['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u
','v','w','x','y','z',]
print(NameList[X].capitalize() + NameList[X] + NameList[X)

1 Answer

7 votes

Final answer:

To spell your first and last name using the NameList variable, you can use the indices of the letters in your name. Using the provided NameList, your first and last name spelled would be 'John Doe'.

Step-by-step explanation:

To spell your first and last name using the NameList variable, you can use the indices of the letters in your name. Suppose your first name is 'John' and your last name is 'Doe'. To spell your name using NameList, you would use:

NameList[9].capitalize() to get the letter 'J'

NameList[14] for the letter 'o'

NameList[7] for the letter 'h'

NameList[13] for the letter 'n'

NameList[3] for the letter 'D' in your last name

NameList[14] for the letter 'o'

NameList[4] for the letter 'e'

Putting it all together, your first and last name spelled using NameList would be 'John Doe'.

answered
User Moddaman
by
8.7k points