Which of the following in not valid string operation?
Slicing
Updating
Repetition
Floor
Answers
Answer:
Option c
Explanation:
Repetition is the correct one
Answer:
The right answer is floor.
Explanation:
A string operation is the group of characters which can be operated by NULL function.
String is also known as a sequence of characters.
Programming languages widely using string languages are c, c++, python.
Here, the string operation used in python language is as follows:
1. Slicing:
A slicing string that is slice( ) are used create a object that are a set of indices by ranges of start, stop and step.
Syntax for slicing:
S[start_pos:end_pos:step]
Here, start_pos is neginning index of substring.
End-pos is end index
Step is steps followed form beginning to end.
2. Updating:
A updating string is used for updating an existing string to another new string which will be replaced with new value.
Syntax of update string:
A = {'q', 'b'}
B = {6, 2, 3}
result = A.update(B)
print('A =', A)
print('result =', result)
Output:
A = {'q', 6, 2, 3, 'b'}
result = None
3. Repetition:
A Repetition string is used for checking the length of the word or sentences. It is denoted by a ‘*’ symbol, it helps in number of characters entered.
Example:
str = 'Python program'
print(str*3)
Output:
Python program python program python program.
#SPJ3