Question: Python method Write a method named modifyName with the following specification: Input parameters: -variable named n , type int : number to adjust list size
Python method
Write a method named modifyName with the following specification:
Input parameters:
-variable named n , type int : number to adjust list size
The return value should be a string, containing:
-n times the first two characters of the name supplied during object construction, -n times the last two characters of the name supplied during object construction, and -n times the sequence of odd positioned characters of the name supplied during object construction.
If the name has only one character, then use it in all the above cases. If the name is empty, then the return of this method should also be empty.
For example,
a = Assignment2("Alex")
ret = a.modifyName(3)
print(ret)
should print AlAlAlexexexAeAeAe.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
