Question: These are all using python. 1. What does the following function print? def add_something() : x = '54' y = '42' print(x + y) A.

These are all using python.

1.

What does the following function print?

def add_something() :
 x = '54'
 y = '42'
 print(x + y) 
A.
Impossible to tell without running the code
B.
96 
C.
5442 
D.
12 

2.

What shape does the following function draw? Assume t is a turtle; n and length are integers.

def mystery(t, n, length) :
 angle = 360/n
 for i in range(n) :
 t.forward(length)
 t.left(angle) 
A.
a polygon with n sides 
B.
a circle
C.
a right triangle
D.
the letter H

3.

What is the order (by line number) in which the following statements execute?

1. def avg_nums(numbers): #numbers is a list of numbers 2. total = 0 #Set up the accumulator pattern 3. for num in numbers: 4. total = total + num 5. return total/len(numbers) #Return the average

6. list_of_numbers = [12, 15, 7] 7. avg = avg_nums(list_of_numbers) 8. print("The average is", avg)

A.

1 2 3 3 3 4 4 4 5 6 7 8

B.

1 2 3 4 5 6 7 8

C.

1 2 3 4 5 6 7 2 3 4 5 7 8

D.

1 6 7 1 2 3 4 3 4 3 4 5 7 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!