201k views
1 vote
False

2. Complete the script by filling in the missing parts. The function receives a name, then returns a greeting based on
whether or not that name is "Taylor".
1
2
3
4
def greeting(name):
if
"Taylor":
return "Welcome back Taylor!"
5
6
return "Hello there,
+ name
7
8
print(greeting("Taylor"))
print(greeting("John"))
Run
Reset
3. What's the output of this code if number equals 10?
1
2
3
4
if number > 11:
print(e)
elif number ! - 10:
print(1)
elif number >= 20 or number < 12:
print(2)
else:
print(3)
5
6
7
8

User Noich
by
3.5k points

1 Answer

5 votes

Answer:

Step-by-step explanation:

2. #The correct finished code would be the following.

def greeting(name):

if name == 'Taylor':

return "Welcome back Taylor!"

else:

return "Hello there, " + name

print(greeting("Taylor"))

print(greeting("John"))

3. The output of this code will be 2 , this is because the second elif statement states that if the number is greater than 20 or less than 12 to print out the value 2. Since the input number is 10 then that is the elif that will be called.

False 2. Complete the script by filling in the missing parts. The function receives-example-1
User Sheo Narayan
by
3.4k points