Answer:
if(y==0)
{
x=100;
}
Explanation:
The above written if statement is for assigning 100 to x when the value of y is equal to 0.To check the value of the y I have used equal operator == which returns true when the value on it's left side is equal to the value to it's right else it returns false and for assigning the value to y I have used assignment operator =.
First it will be checked that the value y is equal to 0.If the then it return true means the if statement will execute.Inside if statement 100 is assigned to x.
Answer:
num1 = 600
Explanation:
Given
The attached code snippet
Required
The output of n = funcOne(funcTwo(n)); when n = 30
The inner function is first executed, i.e.
funcTwo(n)
When n = 30, we have:
funcTwo(30)
This returns the product of n and 10 i.e. 30 * 10 = 300
So:
funcTwo(30) = 300
n = funcOne(funcTwo(n)); becomes: n = funcOne(300);
This passes 300 to funcOne; So, we have:
n = funcOne(300);
This returns the product of n and 2 i.e. 300 * 2 = 600
Hence, the output is 600
The overall goal of this function is to take a list of words that we got as input, a list of words to check for if they appear in the input outputs to return if something from the list to check is in the input list.
Define a function, called selector.
This function should have the following inputs, outputs and internal procedures:
Input(s)
input_list - list of string
check_list - list of string
return_list - list of string
Output(s):
output - string, or None
Procedure(s):
Initialize output to None
Loop through each element in input_list
Use a conditional to check if the current element is in check_list
If it is, assign output as the returned value of calling the random.choice function on return_list
Also, break out of the loop
At the end of the function, return output Note that if we don't find any words from input_list that are in check_list, output will be returned as None.
Answer:
See explaination
Explanation:
# Import required the module.
import random
# Define a function selector() which accepts the
# input_list, check_list, and return_list and
# returns a string named output.
def selector(input_list,check_list,return_list):
# Assign None to string variable output.
output=None
# Use for loop to traverse through input_list.
for i in range(len(input_list)):
# Check if element of an input_list is present
# in check_list.
if input_list[i] in check_list:
# Assign a random value from return_list
# to output.
output=random.choice(return_list)
# break out of the loop if input_list
# element is present in check_list.
break
#
return output
# Use assert statement to test a condition.
# If the condition is true, then program continues to
# execute, otherwise raises an AssertionError.
assert callable(selector)
assert selector(['is','in','of'],['of'], ['Yes']) == 'Yes'
assert selector(['is','in'],['of'], ['Yes','No']) == None
# Display the output.
print(selector(['is','in','of'],['of'], ['Yes']))
print(selector(['is','in'],['of'], ['Yes','No']))
Answer: Exception
Explanation: A throw statement is a statement that whenever it gets executed ,it stops the flow of the execution immediately. The throw statement has a throw keyword for stopping of the execution which is denoted as the exception. A checked or unchecked exception can only be thrown. The compiler of a program has the function of giving warning if there are chances of exception.
Answer:
the answer is c
Explanation:
i just took the test
Answer:c
Explanation: because Diagnosing looks for the nature of the problem, while troubleshooting attempts to identify the source of the problem.