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
cricket20 [7]
3 years ago
13

What will be displayed after the following code is executed? def pass_it(x, y): z = x*y result = get_result(z) return(result) de

f get_result(number): z = number + 2 return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)
Computers and Technology
1 answer:
Rus_ich [418]3 years ago
7 0

Answer:

The output of the following code is "14".  

Explanation:

In the python program firstly we define a function that is  pass_it() function. In this function, we pass the two variable that is x,y. Then we define two variable z and result in the function. The z variable is used to store the multiplication value of the x,y. In the result variable, we use another function that is get_result() function in this function we pass the value of the z variable as a parameter. This function adds a value that is 2 and returns its value. Then we declare a variable that is num1 and num2. In this variable, we assign value that is 3 and 4 and return value of the pass_it() function in the answer variable and print it.  

You might be interested in
In this question, you will experimentally verify the sensitivity of using a precise Pi to the accuracy of computing area. You ne
zhannawk [14.2K]

Answer:

Follows are the code to this question:

import math as x #import math package

#option a

radius = 10#defining radius variable  

print("radius = ", radius)#print radius value

realA = x.pi * radius * radius#calculate the area in realA variable

print("\nrealA = ", realA)#print realA value

#option b

a1 = 3.1  * radius * radius#calculate first area in a1 variable  

print("Area 1= ", a1)#print Area

print("Percentage difference= ", ((realA - a1)/realA) * 100) #print difference  

a2 = 3.14  * radius * radius#calculate first area in a2 variable                            

print("Area 2= ", a2)#print Area

print("Percentage difference= ", ((realA - a2)/realA) * 100)#print difference  

a3 = 3.141  * radius * radius#calculate first area in a2 variable                       print("Area 3= ", a3)#print Area

print("Percentage difference= ", ((realA - a3)/realA) * 100) #print difference  

Output:

please find the attached file.

Explanation:

In the given Python code, firstly we import the math package after importing the package a "radius" variable is defined, that holds a value 10, in the next step, a "realA" variable is defined that calculate the area value.

In the next step, the "a1, a2, and a3" variable is used, which holds three values, that is "3.1, 3.14, and 3.141", and use the print method to print its percentage difference value.  

4 0
3 years ago
GoodArray hackerrank solution for a number N, a goodArray is the smallest possible array that consists of only powers of two
Paladinen [302]

Using the knowledge in computational language in python it is possible to write a code that smallest possible array that consists of only powers of two.

<h3>Writting the code in python:</h3>

<em>"public class GoodArray {"</em>

<em />

<em> "public static List<Integer> getQueryResults(long N, List<List<Integer>> queries) {"</em>

<em />

<em>  "List<Integer> res = new ArrayList<>();"</em>

<em>  int[][] arr = new int[queries.size()][3];</em>

<em>  "List<Integer> goodArray = new ArrayList<>();"</em>

<em>  "for (int i = 1; i <= N; i++) {"</em>

<em>   "int num = i;"</em>

<em>   "while (num % 2 == 0) {"</em>

<em>    "goodArray.add(num);"</em>

<em>    "num = num / 2;"</em>

<em>   }</em>

<em>  }</em>

<em>  int index = 0;</em>

<em>  for (List<Integer> l : queries) {</em>

<em>   arr[index][0] = l.get(0);</em>

<em>   arr[index][1] = l.get(1);</em>

<em>   arr[index][2] = l.get(2);</em>

<em>   index++;</em>

<em>  }</em>

<em>  Collections.sort(goodArray);</em>

<em>  "for (int i = 0; i < arr.length; i++) {"</em>

<em>   "int[] query = arr[i];"</em>

<em>   int l = query[0];</em>

<em>   int r = query[1];</em>

<em>   int m = query[2];</em>

<em>   int prod = 1;</em>

<em>   "for (int j = l - 1; j <= r - 1; j++) {"</em>

<em>    "prod = (int) (prod * goodArray.get(j)) % m;"</em>

<em>   }</em>

<em>   res.add(prod);</em>

<em>  }</em>

<em>  return res;</em>

<em> }</em>

<em />

<em>}</em>

See more about python at brainly.com/question/18502436

#SPJ1

8 0
2 years ago
Many Internet servers have an easy-to-remember name, such as nike. The official term for this name is ____.
san4es73 [151]

Answer:

SSID

Explanation:

i tried

..............

6 0
3 years ago
Assume that an array of integers named a that contains exactly five elements has been declared and initialized. Write a single s
Alik [6]

array[0] = 2 * array[4];

5 0
3 years ago
Choose the two (2) statements that are true about functions​
Natalka [10]

Answer:

In the given question statements are missing. So, we assume two true statements. Which can be given as :

  • Function name should be meaning full  
  • Programming features are called programming instruction groupings.

Explanation:

In the programming language, a function is a group of organized code that is used to increases the reusability of the program. In the declaration of the function we should remember two points which is can be described as:

  • function name should be meaning full means is that if we want to print some data in function. So, we write a function name that is matched to its data like message, information, data, etc. these names help another programmer to understand more easily.  
  • In the function, Programming features are called programming instruction groupings.

That's are the statements for function that is described above.

4 0
3 years ago
Other questions:
  • Chances are if you ar Chances are, if you are involved in a crash, it will happen __________ a. during a long trip. b. close to
    7·2 answers
  • ________ means that IT capacity can be easily scaled up or down as needed,which essentially requires cloud computing. A) agility
    15·1 answer
  • How many times will the while loop that follows be executed? var months = 5; var i = 1; while (i &lt; months) { futureValue = fu
    10·1 answer
  • If you were investigating login issues on a Windows computer, which portion of the Event Viewer logs would be a good place to st
    7·1 answer
  • If you’re the victim of cyber bullying behavior, besides contacting your teacher or the school, where else can you go to find in
    13·1 answer
  • Question 1<br> REVPAR and REVPOR are basically the same thing.<br> True<br> False
    11·1 answer
  • Your ___ can provide hardware firewall protection for your home network where it connects to the ISP's network, just as ISP netw
    12·1 answer
  • Using truth table, prove that:<br><br> (A + B). C = (A . C)+ (B .C) ?
    7·1 answer
  • Write a perl program that reads from a file containing a list of names and then displays that list to a user. The program should
    11·1 answer
  • B. What significant values have you learned while learning the tools and utensils?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!