QUESTION IMAGE
Question
weve made a small modification to the join function:
def join(word1, word2, delimiter= ):
if len(delimiter) > 0 :
joined = str(word1) + str(delimiter) + str(word2)
return joined
what will be printed if we run the following code?
result = join( delimiter=\\, word2=\one\, word1=\two\)
print(result)
note: the delimiter is the empty string and its length is zero.
Step1: Analyze the function call
The function join is called with word1 = "two", word2 = "one", and delimiter = "".
Step2: Check the condition
Since len(delimiter) = len("") = 0, the if - block (if len(delimiter)>0) is not executed.
Step3: Determine the return value
As the if - block is skipped, the function does not return anything (in Python, a function that reaches the end without a return statement returns None).
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
None