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
Create a function named CountVowels() that takes one parameter name epsilon
LenaWriter [7]

def CountVowels(epsilon):

   countNum = 0

   for x in range(len(epsilon)):

       letter = epsilon[x]

       if letter.lower() in "aeiou":

           countNum += 1

   return countNum

def ExtractOdds(zeta):

   result = ""

   for x in range(len(zeta)):

       if x % 2 == 1:

           result += zeta[x]

   return result

sentence_A = input("Enter a sentence: ")

sentence_B = input("Enter a sentence: ")

print(CountVowels(sentence_A))

print(ExtractOdds(sentence_B))

I hope this helps!

5 0
3 years ago
Over a TCP connection, suppose host A sends two segments to host B, host B sends an acknowledgement for each segment, the first
Margaret [11]

Answer:

a. Host A will retransmit neither segments

Explanation:

The options are:

a. Host A will retransmit neither segments

b. Host A will retransmit first segment

c. Host A will retransmit the second segment

d. Host A will retransmit both segments

The first acknowledgment is lost but the second acknowledgment arrives before the timer of the first segment expires, and hence the host A gets confirmation that Host B has received both the segments. And hence Host A will retransmit neither segments.

4 0
3 years ago
A help desk technician determines that a user's issue is caused by a corrupt file on their computer. What is the fastest way to
vesna_86 [32]

The fastest way to transfer a good file to the computer is Use the C$ administrative share to copy the file.

<h3>How do I copy a file?</h3>

To copy a file, right-click on the desired file and select Copy. Alternatively, you can use the keyboard shortcut. To copy the item: click Ctrl+C. Navigate to the folder you want to move or copy the item to and click Ctrl+V or right-click and select paste.

To automatically paste the text, you will be inserting the copied content, which is in the clipboard to the desired location by the user, since such an operation only works if something has previously been copied or cut.

See more about copy a file at brainly.com/question/18241798

#SPJ1

5 0
1 year ago
You have created a slide that is functional, but a bit on the boring side. In five to ten sentences, describe changes you would
Bess [88]
To make my slide more effective, I would add two or three pale colors that would decorate it while not distracting viewers from the topic. I would also add visuals that would engage viewers and give them a better understanding of the material. Additionally, I would include more examples and details to give viewers a clearer picture of what I would be attempting to convey to them. The final thing I would do to the slide would be to organize it in a way that would present information well. In conclusion, in order to improve the effectiveness of a slide, I would make changes to its design and layout that would make it easier for viewers of the slide to understand.
4 0
2 years ago
1. Which of the following is a search engine?
Effectus [21]
<span>C)Google
D) Search engines often provide different results, even when you enter the same query.
</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • Andrea wants to to install a new internet connection . she eants to use the fastest one she can find . what are the maximum spee
    14·1 answer
  • Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw(
    14·1 answer
  • How can cybercriminals harm a person whose personal information they have stolen
    7·1 answer
  • Why do nonprofit agencies often include blogs on their websites?
    5·1 answer
  • Percy is a lighting technician in a film production. For a shot, the chief lighting technician instructs Percy to get the kind o
    15·1 answer
  • What type of formatting does the clip below demonstrate
    6·1 answer
  • How can rows be added to a table? Check all that apply
    13·2 answers
  • Write a program that displays the values in the list numbers in ascendingorder sorted by the sum of their digits.
    8·1 answer
  • Does anyone know what happened to Cole Morgen, the actor?
    11·1 answer
  • The ____ contains app buttons that allow you to quickly run the File Explorer or Microsoft Edge apps.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!