Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Annotate every line of code. You may want to google line 7 which is a common convention in Python code but sort of odd.
Instructions
Annotate every line of code.
You may want to google line which is a common convention in Python code but sort of odd.
Make it so that average values only averages the nonnegative values. For example, average should
return Hint: If you feel stuck, look at the "Conditionals" information near the bottom of this week's "Repetition" Notebook.
def averagevalues:
sum ;
for in rangelenvalues:
sum sum values
return sumlenvalues
if : # I recommend researching online what this line of code is doing it has a unique purpose
but is commonly used.
values
# values
# values
# values
# values
printThe average is averagevalues
# Annotate code.
# Make it so that averagevalues only averages the nonnegative values
# average should return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started