Answer:
The solution code is written in Python:
- def add_spaces(s):
- if len(s) < 2:
- return s
- else:
- return s[0] + " " + add_spaces( s[1 : ] )
Explanation:
Recursive function is a function that will call itself within the same function.
Let create a function named add_spaces() that take one input string, s (Line 1).
Next, create an if condition to check if the length of the input string is less than 2 (this means if the string has only one character), return the current string (Line 2-3).
Otherwise, it should return the first character of string, s[0] concatenated with a single space " " and concatenated again with the return output from the recursive calling add_spaces() that take s[1: ] as input parameter (Line 4-5). Please note s[1: ] is an expression we get the substring of the current string from position 1 till the end of string.
Answer:
Encapsulation
Explanation:
Encapsulation is referring to the concept that data buding with some approach or method that is applied to that selected data. it also restricts the use of some internal data of an object. The motive behind restricting the data is to prevent the misuse of the data.
For example- in java, encapsulation is refer to the wrapping of code with the data in one unit.
You have to put some info about your sport in the blue area. In the bracketed area.
<h3>An attribute is a characteristic.In a data base management system,an attribute refers to a database component,such as a table.It also may refer to a database field.</h3>