Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python: most work for any situation not just test cases Function name: make_gamertag Parameters: a string representing our inspiration for the gamer tag, and a
Python: most work for any situation not just test cases
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 "T T 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 trylexcept in this function. >>> aList = [28, 4, 50, 0, -2, 3] >>> aStr "Aw Geez Rick" >>> tag1 = make-gamertag(astr, aList) >>> print (tagi) [BexBAxcxGx >>alist [19,8,17,6,15,4,13,2,11] >>> astr "LEEEeeeEEROY JEENNKKINS" >>> tag2 = make-gamertag(astr, aList >>> print (tag2) [KxExNxexExexJxExYx] 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 "T T 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 trylexcept in this function. >>> aList = [28, 4, 50, 0, -2, 3] >>> aStr "Aw Geez Rick" >>> tag1 = make-gamertag(astr, aList) >>> print (tagi) [BexBAxcxGx >>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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started