Redefined Outer Name 1 When writing code inside an inner block (such as within a function definition), care must be taken so as to not redefine variables from the outside the block that are still in use. The code below uses a name from an outer block (the function name) in an inner block (the function body). Submit the provided code and click on the "Expand for Detailed Error Message" dropdown to determine where the Redefined Outer Name error occurs. Then, make changes to the starter code to resolve the error. 1 def total_apples (apples_per_tree: int, trees: int) -> int: 3 "Return the total number of apples in an apple orchard given the number of trees and the number of apples per tree.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 13E
icon
Related questions
Question

Please write the correct code for this question. I really don't know what can be changed.

Redefined Outer Name 1
When writing code inside an inner block (such as within a function definition), care must be taken so as to not redefine variables from the outside
the block that are still in use.
The code below uses a name from an outer block (the function name) in an inner block (the function body). Submit the provided code and click
on the "Expand for Detailed Error Message" dropdown to determine where the Redefined Outer Name error occurs. Then, make changes to the
starter code to resolve the error.
1 def total_apples (apples_per_tree: int, trees: int) -> int:
3
4
5
6
co 00
8
9
""Return the total number of apples in an apple orchard given
the number of trees and the number of apples per tree.
###
>>> total_apples (4, 7)
28
###
total_apples = apples_per_tree * trees
return total_apples
Transcribed Image Text:Redefined Outer Name 1 When writing code inside an inner block (such as within a function definition), care must be taken so as to not redefine variables from the outside the block that are still in use. The code below uses a name from an outer block (the function name) in an inner block (the function body). Submit the provided code and click on the "Expand for Detailed Error Message" dropdown to determine where the Redefined Outer Name error occurs. Then, make changes to the starter code to resolve the error. 1 def total_apples (apples_per_tree: int, trees: int) -> int: 3 4 5 6 co 00 8 9 ""Return the total number of apples in an apple orchard given the number of trees and the number of apples per tree. ### >>> total_apples (4, 7) 28 ### total_apples = apples_per_tree * trees return total_apples
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Events
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning