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

What is the output of the code below assuming that global variable x has value 2 and global y has value 3? def f1(): return "ab"

def f2(): return f1() * x def f3(): return f2() + f1() * y print(f3())
Computers and Technology
1 answer:
Lostsunrise [7]3 years ago
7 0

Answer:

ababababab

Explanation:

The code above is written in python and python uses indentation .So let me rephrase the code accordingly and explain what the code really do.

Note x and y is a global variable which can be used by any of the function declared.  According to the question x and y are 2 and 3 respectively

The first block of code describes a function f1 without any argument but the code should return the string "ab"

def f1():

      return "ab"

The second block of code defines a function f2 and returns the value of f1 multiply by x. This means you are multiplying the string "ab" by 2 which will be equals to abab

def f2():

           return f1() * x

The third block of code declared a function f3 and returns the sum of  f2 and product of f1 and y. using PEMDAS principle the multiplication aspect will be solved first so, ab × 3 = ababab, then we add it to f2  . ababab + abab = ababababab.

def f3():

        return f2() + f1() * y

Finally, we print the function f3 value to get ababababab

print(f3())

If you run the code on your IDE like below you will get  ababababab

x = 2

y = 3

def f1():

      return "ab"  

def f2():

      return f1() * x  

def f3():  

      return f2() + f1() * y  

print(f3())

     

You might be interested in
A standard for compressing music into computer files that can be easily exchanged on the Internet is called a(n) ______. A. musi
Sophie [7]

Answer:

The correct answer is E. MP3

Explanation:

MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio. MP3 as a file format commonly designates files containing an elementary stream of MPEG-1 audio and video encoded data, without other complexities of the MP3 standard. The MP3 format makes it possible to compress a song into a file small enough to be uploaded, downloaded, emailed, and stored on a hard drive.

4 0
4 years ago
What is the main difference between a literacy society and a digital Society
EleoNora [17]
The accurate answer is

The difference is a Literacy Society is a program for encouraging people to read.
A Digital Society is a program that as to do with technology at work,school, or at home.

Glad to help :) 
7 0
3 years ago
Which of the following should NOT be done to keep people from slipping on floors? A) Have the proper absorbents in an easy-to-fi
RoseWind [281]

The following options helps keep people from slipping on floors

A) Have the proper absorbents in an easy-to-find place to quickly put on spills : So that accidental little spills can be cleaned right away.

C) Wear slip-resistant footwear : It is a precautionary step to follow, no matter where we go.

D) Mark a slippery area with an easy-to-use tent sign that says " Caution, Slippery floor" : This allows people to be aware of the wet area and cross it cautiously.

Leaving oil and fluids to air dry thoroughly, takes a long time and there are chances that people step over it and slip.

So, the answer is

(B) Anytime oil or fluids are spilled on the floor, leave them to thoroughly air dry.

8 0
4 years ago
Read 2 more answers
With landscape photography, which depth of field do you normally want? A) Small B)Small to Medium C)Large D)With landscapes it d
RideAnS [48]
I am not 100% on this but i think you would want a Large depth of field. 
3 0
4 years ago
Read 2 more answers
What is MS Paint ?<br><img src="https://tex.z-dn.net/?f=%20computer" id="TexFormula1" title=" computer" alt=" computer" align="a
nignag [31]

Answer:

Microsoft Paint, also known as Paint, is a simple program that allows users to create basic graphic art on a computer. Included with every version of Microsoft Windows since its inception. Paint provides basic functionality for drawing and painting in color or black and white, and shaped stencils and cured line tools.

4 0
3 years ago
Other questions:
  • What are the meaning master files<br>​
    8·1 answer
  • What is mendix about?
    10·1 answer
  • Which command allows d1 to configure an ip address on one of its physical interfaces?
    9·1 answer
  • Which line of code will eliminate the element “calculator” from an array of supplies?
    13·1 answer
  • Scenario
    7·1 answer
  • Describa la clasificación de los recursos educativos digitales abiertos. vea este video, para hacer eso
    11·2 answers
  • Juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh
    6·1 answer
  • Location of a video or photoshoot is not important when it comes to preplanning the shoot.
    10·1 answer
  • Question 5 / 15
    11·2 answers
  • For computer forensics, ____________ is the task of collecting digital evidence from electronic media.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!