Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

def mystery(l):
l = l + l
return()

mylist = [22,34,57]
mystery(mylist)


value of mylist after execution of function
Given 3 int values, a b c, return their sum. However, if any of the values is a teen -- in the range 13..19 inclusive -- then that value counts as 0, except 15 and 16 do not count as a teens. Write a separate helper "def fix_teen(n):"that takes in an int value and returns that value fixed for the teen rule. In this way, you avoid repeating the teen code 3 times (i.e. "decomposition"). Define the helper below and at the same indent level as the main no_teen_sum().
Write a function that takes two parameters (days_count:int, current_day: str)
where the current_day is anything from ["sun", "mon", "tue", "wed", "thur", "fri", "sat"]
and returns the day that occurs after the number of days_count


defget_day(days_count, current_day):
# your code here


return
example:
get_day(3, "mon") # result --------> "thur"
get_day(10, "wed") # result --------> "sat"
My first
project is to help them design an application using Python that will help shoppers determine which
products to buy at the supermarket and price after a percentage discount is applied.

At a minimum, my application will:
1. Provide a menu asking the type of calculation needed (discount or best buy)
2. Based on the selection appropriate prompts should be presented
3. For best buy;
a. Ask for the cost of at least two products
b. Ask for the mass or quantity of the products
c. Tell the user which product is better value
4. For discount, consider a case where either the percentage discount is given, or the prices before and
after discount are given.
a. For the first case, you should ask the user for the ticket price and percentage discount then tell
the user the unit price after discount
b. For the second case, you should ask the user for the price before discount and after discount in
order to inform the user of the percentage discount
c. Finally, tell the user of the best deal
Write a function in this file called nine_lines that uses the function three_lines (provided below) to print a total of nine lines.

Now add a function named clear_screen that uses a combination of the functions nine_lines, three_lines, and new_line (provided below) to print a total of twenty-five lines. The last line of your program should call the function clear_screen.

The function three_lines and new_line are defined below so that you can see nested function calls. Also, to make counting “blank” lines visually easier, the print command inside new_line will print a dot at the beginning of the line:

def new_line():

print('.')

def three_lines():

new_line()

new_line()

new_line()
Given a list of strings, return the count of the number of
strings where the string length is 2 or more and the first
and last chars of the string are the same.
Word1= ['aba', 'xyz', 'aa', 'x', 'bbb']
Word2 = ['', 'x', 'xy', 'xyx', 'xx']
Word3 = ['aaa', 'be', 'abc', 'hello']
1. What gets printed?
while a = 10:
print('Howdy')

2. What is printed by the python code?
Print 14/4, 14%4, 14.0/4

3. What is printed by the python code?
print '2' + '3'

4. What is printed by the Python code?
for i in range(4):
print (i)

5. Given a string s, write a short expression for a string that includes s repeated five times.
1. What will be the result of print W?
s=["apples", "bananas", "carrots]
W=[len(w) for w in s]

2. What is the output of print "hello"+1+2+3

3. What gets printed?
name = "snow storm"
name[5] = 'X'
print name
1. What is the result of the expression shown below if x = 56.236?
print("%.2f"%x)
a)56.00
b)56.24
c)56.23
d)0056.236

2. What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print (x)
a)['ab', 'cd']
b)['AB', 'CD']
c)[None, None]
d)none of the mentioned
Consider the following statements. Explain why some statements fail and correct the errors. In the case of no error give the correct answer.
a. x=1; print 'sin(%g)=%g' % (x, sin(x))
b. C=A+B; A=3; B=2; print C
c. C=21.0; F=9.*(C/5.0)+32; print F
d. t=(2, 4, 6, 'temp.pdf'); t[1]=4; print t
LATEST TUTORIALS
APPROVED BY CLIENTS