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
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