edhesive 7.6 lesson practice python

def mystery(a, b = 8, c = -6):
return 2 * b + a + 3 * c

#MAIN
x = int(input("First value: "))
y = int(input("Second value: "))
z = int(input("Third value: "))

1) Suppose we add the following line of code to our program:

print(mystery(x))
What is output when the user enters 1, 1, and 1?

2)Suppose we add the following line of code to our program:

print(mystery(x, y, z))
What is output when the user enters 8, 6, and 4?

Answers

Answer 1

Answer:

(a) The output is -1

(b) The output is 32

Explanation:

Given: The above code

Solving (a): The output when 1, 1 and 1 is passed to the function

From the question, we have: print(mystery(x))

This means that only the value of x (which in this case is 1) will be passed to the mystery function

(a, b = 8, c = -6) will then be seen as: (a = 1, b = 8, c = -6)

[tex]2 * b + a + 3 * c = 2 * 8 + 1 + 3 * -6[/tex]

[tex]2 * b + a + 3 * c = -1[/tex]

The output is -1

Solving (b): The output when 8, 6 and 4 is passed to the function

From the question, we have: print(mystery(x,y,z))

This means that values passed to the function are: x = 8, y = 6 and z = 4

(a, b = 8, c = -6) will then be seen as: (a = 8, b = 6, c = 4)

[tex]2 * b + a + 3 * c = 2 * 6 + 8 + 3 * 4[/tex]

[tex]2 * b + a + 3 * c = 32[/tex]

The output is 32

Answer 2

If we add the line of code print(mystery(x)) and our input are 1, 1 and 1 the output will be -1.

If we add the line of code print(mystery(x, y, z)) and our inputs are 8, 6 and 4 the out put will be 32.

This is the python code:

def mystery(a, b = 8, c = -6):

  return 2 * b + a + 3 * c

#MAIN

x = int(input("First value: "))

y = int(input("Second value: "))

z = int(input("Third value: "))

print(mystery(x))

#What is output when the user enters 1, 1, and 1?

#Suppose we add the following line of code to our program:

print(mystery(x, y, z))

#What is output when the user enters 8, 6, and 4?

The code is written in python

Code explanation:The first line of code defines a function named mystery with the argument a, b by default is equals to 8 and c is equals to -6 by default. Then the code return the product of b and 2 plus a and plus the product of 3 and c.  x, y and z variable that stores the users input.Then we call the function mystery  with a single argumentThen we call the function mystery with three argument x, y and z which are the users input.  

The first print statement with the input as 1, 1 and 1 will return -1

The second print statement with the input 8, 6 and 4 will return 32.

learn more on python code here: https://brainly.com/question/20312196?referrer=searchResults

Edhesive 7.6 Lesson Practice Pythondef Mystery(a, B = 8, C = -6): Return 2 * B + A + 3 * C#MAINx = Int(input("First
Edhesive 7.6 Lesson Practice Pythondef Mystery(a, B = 8, C = -6): Return 2 * B + A + 3 * C#MAINx = Int(input("First

Related Questions

Other Questions
Please Help!! Brainliest Answer! Thank you! A tip for great service is 20% of the bill. If the bill for dinner is $32, what is the total cost of dinner? Which organelle is like the brain of the cell? vacuole O endoplasmic reticulum O cytoplasm O nucleus cogenuity QuizFind the value of 6^3.OA) 6) 36OC) 72OD) 216 Which situation would be more likely to occur in the modern era than in earlierperiods of human history? Which one, please?!Quickly! Find the amount and compound interest on 5000 at 6% per annum for 3 years annual the effect of polythene on the environment - essay - USE ABOUT 50 OR 60 WORDS Find all numbers whose absolute value is -7. If there is more than one, separate them with commas. 4--9w^2Can Someone help PLS One of the flags in front of the United Nations sits on a pole 80 feet tall and castsa shadow 16 feet long. At the same time of the day, another flag casts a shadow18 feet long. How high is the other flag?HELPPPPP Jose deposits S300 into an account that pays simple interest at a rate of 6% per year. How much interest will he be paid in the first 3 years? What factors allowed the Industrial Revolution to occur? how many 2/5's are in 3 What keeps you from being organized? Natalie has a coin collection. She keeps 4 of the coins in her box, which is 10% of the collection. How many total coins are in her collection? The domestication of plants and animals involved:A: human selection of particular traits in wild plants and animals. B: natural selection of particular traits in wild plants and animals.C: communication among distant settlements that shared ideas and results of experiments with different wild resources.O D:potlatches. Look at the dots around each symbol and the energy levels from the resources above;Answer the questions in the text entry option for this assignment.Copy and paste questions and respond in complete sentences.Include a space between each question.Be specific with your responses for each question. Assume your reader has no knowledge of the subject and you are teaching them via your answers.Please answer the following questions:Why does Na have only one dot?Why do none of these diagrams show more than 8 dots?What relationship do you notice between the dots in these two charts?The number of dots that hydrogen and helium have in their dot diagram is the same as the number of electrons shown for them on the Periodic Table. Why? (Hint: Octet Rule (Links to an external site.)) Explore the three different types of ground tissue cells in detail and complete the chart below. Can yall recount a story where you were proud of yourself for making a good decision when it was really difficult? Thanks!