If you are working in a word-processing program and need to learn more about its features, the best place to get assistance is from the <span>application's Help menu. The help menu is usually located on the top right or left hand side corner of your window.</span>
Answer:
decode( )
Explanation:
We can use the method decode( ) to decode the string using the codec registered for encoding.
There are two parameters
encoding: We can encode with this parameter.
errors: If used to manage the errors.
For example:
String = "this is string example....wow!!!";
String = Str.encode('base64','strict');
If we print these variables we have:
String = b'dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE='
String = this is string example....wow!!!
Answer:
<u>for loop code:</u>
int total=0;
for(int i=0;i<10;i++)
{
total + = value[i];
}
Explanation:
By declaration we know that the array is of size 10 which means the index will start from 0.
The variable name to be used to store the sum is given as total
We will initialize total with zero so that no garbage value is used.
For loop will be used to access the elements of array and calculate the sum. The syntax of for loop is given as:
for (initialization; condition; increment/decrement)
{statement}
<u>Code:</u>
int total=0;
for(int i=0;i<10;i++)
{
total + = value[i];
}
Answer:
string=""
while string not in {"Quit","quit","q"}:
string=input("Enter line to be reversed") #line of text will be entered
if string!="Quit" and string!="quit" and string!="q": #If quit is not entered
print("Reverse of line is : ")
print(string[::-1])
OUTPUT :
Enter line to be reversedThis code is in python language
Reverse of line is :
egaugnal nohtyp ni si edoc sihT
Enter line to be reversedHello world
Reverse of line is :
dlrow olleH
Enter line to be reversedquit
Explanation:In the above program, First a while loop is executed and checked if line of text is not 'quit', 'Quit' or 'q'. If condition is true, then loop is executed and in python any string or list can be traversed from end if step is given -1. Similarly line of text is accessed from the last element. If quit is entered, then the program will be broken out of the loop.