Question: I have only figured it out using the len function but can't figure it out without Function name : make_gamertag Parameters : a string representing

I have only figured it out using the len function but can't figure it out without

Function name : make_gamertag Parameters : a string representing our inspiration for the gamer tag, and a list of integers of where we want to index from (assume valid parameters will be passed in every time) Returns : A string representing the gamer tag that we end up with

Description : You are an aspiring gamer. The first step is making an intimidating gamertag, but you need some inspiration. Write a function that takes in a string and a list of integers and adds certain indices (specified in the list) from the string into your soon-to-be tag. Anytime the desired index does not exist in the string, add in a 0 zero to the gamertag, but if the index is valid, add the corresponding character as well as another x just for spice. When you have gone through all entries of the list, surround the tag with square [ ] brackets and return the string. You may assume that valid argument types will always be inputted for this function.

Note : You may NOT use the len( ) function, or you will not receive credit. You MUST use try/except in this function.

Test Cases : >>> aList = [20, 4, 50, 0, -2, 3] >>> aStr = "Aw Geez Rick" >>> tag1 = make_gamertag(aStr, aList) >>> print(tag1) [0ex0AxcxGx]

>>> aList = [19,8,17,6,15,4,13,2,11] >>> aStr = "LEEEeeeEEROY JEENNKKINS" >>> tag2 = make_gamertag(aStr, aList) >>> print(tag2) 
[KxExNxexExexJxExYx] 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!