1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex
3 years ago
11

Edhesive 7.6 lesson practice python

Computers and Technology
1 answer:
spayn [35]3 years ago
6 0

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)

2 * b + a + 3 * c = 2 * 8 + 1 + 3 * -6

2 * b + a + 3 * c = -1

<em>The output is -1</em>

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)

2 * b + a + 3 * c = 2 * 6 + 8 + 3 * 4

2 * b + a + 3 * c = 32

<em>The output is 32</em>

You might be interested in
Write code that does the following: opens an output file with the filename number_list.txt, uses a loop to write the numbers 1 t
Lady_Fox [76]

Answer:

# create the file

filename = "Testfile.txt"

# for writing, we create the output file:

outPutfile = open(filename, "w")

# Writing numbers from 1-100

for item in range(1,101):

 outPutfile.write((str)(item))

outPutfile.close()

# printing the contents to verify it worked correctly

infile = open(filename, "r") #note the "r" indicates the mode

fileContents = infile.read()

infile.close()

print(fileContents)

Explanation:

  • Define the working file fileName = TestFile
  • Create the output file for writting outPutfile = open(filename, "w")
  • Use a for loop to write numbers from 1-100 to the file outPutfile.write((str)(item))
  • Close the file outPutfile.close()
  • You may open the file read its content and print the contents to verify it worked correctly
8 0
3 years ago
Most search engines provide specific pages on which you can search for____ and
vazorg [7]

Answer: c

Explanation: a

7 0
3 years ago
Read 2 more answers
Questions about the data policy and privacy policy of YT
Ilya [14]

Answer:

I'm confused

Explanation:

7 0
3 years ago
What types of user permissions can you set up when adding a new team member in QuickBooks Online Accountant?
e-lub [12.9K]

Answer:

1. Standard User

2. Company Admin

3. Reports only

4. Time tracking only

5. Accountant

Explanation:

There are different types of user permissions one can set up when adding a new team member in QuickBooks Online Accountant. This includes the following:

1. Standard User: this can be utilized to specialize user's access right

2. Company Admin: this gives such users additional or access rights in the firm.

3. Reports only: this gives users the rights to reports only.

4. Time tracking only: this only gives users the ability to see the version that has timesheets and time reports

5. Accountant: this is designed for the firm's accountant.

6 0
2 years ago
Give a big-O estimate for the number additions used in this segment of an algorithm.
rjkz [21]
Big-O notation is a way to describe a function that represents the n amount of times a program/function needs to be executed. 

(I'm assuming that := is a typo and you mean just =, by the way) 

In your case, you have two loops, nested within each other, and both loop to n (inclusive, meaning, that you loop for when i or j is equal to n), and both loops iterate by 1 each loop.

This means that both loops will therefore execute an n amount of times. Now, if the loops were NOT nested, our big-O would be O(2n), because 2 loops would run an n amount of times.

HOWEVER, since the j-loop is nested within i-loop, the j-loop executes every time the i-loop <span>ITERATES. 
</span>
As previously mentioned, for every i-loop, there would be an n amount of executions. So if the i-loop is called an n amount of times by the j loop (which executes n times), the big-O notation would be O(n*n), or O(n^2). 

(tl;dr) In basic, it is O(n^2) because the loops are nested, meaning that the i-loop would be called n times, and for each iteration, it would call the j-loop n times, resulting in n*n runs.

A way to verify this is to write and test program the above. I sometimes find it easier to wrap my head around concepts after testing them myself.
3 0
3 years ago
Other questions:
  • ACCOUNTING
    13·2 answers
  • An application programming interface (API) is: Group of answer choices the code the application software needs in order to inter
    9·1 answer
  • The part of the poppet valve that contacts the valve seat is called the A. face. B. margin. C. head. D. stem.
    6·2 answers
  • "PindCart, an online retailer, places a small file on the computer hard drive of its visitors to recognize them when they revisi
    7·1 answer
  • ​if a primary key combines two or more fields, then it is called a _____.
    14·1 answer
  • During the boot process, the computer performs a quick self diagnostic then loads the operating system into memory.... IS THIS T
    5·1 answer
  • Why computer process faster than humans?​
    10·2 answers
  • Convert the following hexadecimal numbers to decimal: (a) FF (b) F0A2 (c) 0F100 (d) 100
    10·1 answer
  • TRUE OR FALSE!!<br> Your location can be identified simply by turning on your cell phone..
    12·2 answers
  • Why does my roku tv keep disconnecting from the internet.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!