Access over 20 million homework & study documents

search

Its320 mod 5 mastery ex attempt 1

Content type
User Generated
Rating
Showing Page:
1/3
Score for this attempt: 7 out of 10
Submitted Feb 13 at 12:25pm
This attempt took 6 minutes.
Question 1
1 / 1 pts
Which return statement in the following function will return the cubic root of a number?
def cubic_root(num):
return __________
return num**1/3
return num*num*num
return num**(1./3)
return num**(0.33)
Correct! When raising a number to a fractional power, make sure you enclose the
fraction in parentheses and make sure the fraction is a floating-point number.
IncorrectQuestion 2
0 / 1 pts
What is the output of the following code snippet?
my_var = "This is a variable"
def my_func():
pass
print(globals())
something new
a larch

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3
{'my_func': , 'my_var': 'This is a variable'}
a program error
Actually, look again. See the definition of this in section 6.11 in Chapter 6
in Programming in Python 3 with Zylabs for more information.
Question 3
1 / 1 pts
What is the output of the following code snippet?
import math
real_pi = math.pi # math library provides close approximation of pi
approximate_pi = 22.0 / 7.0 # Approximate pi to 2 decimal places
print('22/7 is accurate for 2 decimal places: %.2f' % approximate_pi)
22/7 is accurate for 2 decimal places: 3.141593
22/7 is accurate for 2 decimal places: 3
22/7 is accurate for 2 decimal places:
22/7 is accurate for 2 decimal places: 3.14
Correct! The format specifier “%.2f” rounds the floating-point division to two decimal
places.
Question 4
1 / 1 pts
What is the output of the following code?
def sandwich(bread, meat, *args):
print('%s on %s' % (meat, bread), end=' ')
if len(args) > 0:
print('with', end=' ')
for extra in args:

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Score for this attempt: 7 out of 10 Submitted Feb 13 at 12:25pm This attempt took 6 minutes. Question 1 1 / 1 pts Which return statement in the following function will return the cubic root of a number? def cubic_root(num): return __________ return num**1/3 return num*num*num return num**(1./3) return num**(0.33) Correct! When raising a number to a fractional power, make sure you enclose the fraction in parentheses and make sure the fraction is a floating-point number. IncorrectQuestion 2 0 / 1 pts What is the output of the following code snippet? my_var = "This is a variable" def my_func(): pass print(globals()) something new a larch {'my_func': , 'my_var': 'This is a variable'} a program error Actually, look again. See the definition of this in section 6.11 in Chapter 6 in Programming in Python 3 with Zylabs for more information. Question 3 1 / 1 pts What is the output of the ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Documents