Question: Implement a python constructor that accepts one parameter: age (type int ). This parameter should initialize the similarly named class instance variable (hint: these would
Implement a python constructor that accepts one parameter: age (type int ). This parameter should initialize the similarly named class instance variable (hint: these would start with self. )
Write a python method named changeString that accepts a single argument: n (type string ).
The method should return the same string, but:
each third character should be converted to the uppercase (if not already),
each fourth that is not divisible by 3, should be converted to lower case (if not already),
each fifth that is not divisible by 3 and 4, should be changed to space
Using this example
a = Assignment(age=4)
ret = changeString("foobarBarfoo")
print(ret)
should print foOb RBaRf r .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
