Powerpoint, word document, and excel
You have to subtract the tax amount by the final amount then multiply the result by the percentage of tip that is based on the service that you received.
Answer:
The program to this question as follows:
Program:
def lettersOnly(s): #defining method lettersOnly
val="" #defining string variable that return value
for i in s: #defining loop to calculate value
if(i.isalpha()): #check condition that value is string
val=val+ i #add value
return val #return value
print(lettersOnly("data3base_ro1c3k5s")) #call method and print value
Output:
databaserocks
Explanation:
In the above python code, a method lettersOnly is declared that accepts a string variable "s" in its parameter. Inside the method, a string variable "val", and loop is declared, in which the "val" variable holds method return value.
- In the loop and if block is used that uses "isalpha" string method, which checks the check alphabetic character in the given value. if this is true it will calculate all value in "val" variable and return its value.
- At the last, the print method is used, which calls the lettersOnly method and prints its return value.
Answer:
Option c is the correct answer for the above question.
Explanation:
- The array is used to holds multiple variables and the assignment operator can assign only a single variable at a time. So if a user wants to assign the whole array value into other array value then he needs to follow the loop.
- The loop iteration moves on equal to the size of the array. It is because the array value moves into another array in one by one. It means the single value can move in a single time. So the moving processor from one array to another array takes n times if the first array size is n.
- The above question asked about the processor to move the element from one array to another and the processor is a loop because the loop can execute a single statement into n times. So the C option is correct while the other is not because--
- Option 'a' states about one assignment operator which is used for the one value only.
- Option b states about the equality operator which is used to compare two values at a time.
- Option d states any of these but only option c is the correct answer.
- Option 'e' states none of these but option c is the correct.