Skip to content

Forum in maintenance, we will back soon 🙂

Notifications
Clear all

function homework.

6 Posts
3 Users
1 Reactions
24 Views
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

 

I think you can't remember beginners' mind anymore..

 

not happy coding to me..

 

what does that mean?? you just put questions and answers. but I don't get it..

 
Posted : 07/12/2023 1:07 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

Hi Jay. what exactly you didnt understand here?

 
Posted : 07/13/2023 10:49 am
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@admin

 

 

def calculate_average(numbers) > is fine.

sum_of_numbers = 0 > where does it come from??

 

for number in numbers : > you just put it your way.

sum of numbers += number > what does that mean?

 

average = sum of numbers / len(numbers) 

len(numbers) > length (numbers) , right? still not sure what that mean

 

return average > where does it come from??

 

number = [1,2,3,4,5] > fine

print(calculate_average(numbers)) > not sure.

 

-------------

 

I put what I got and I didn't / 

 

I asked many things within short time. thanks for your helping me . I guess you might know who I am haha.. still keep asking to you. thanks.

 

 

 

 

 
Posted : 07/14/2023 12:56 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

I think you will try again and watch the python lectures from the beginning, then come back.

 
Posted : 07/15/2023 2:37 pm
SSAdvisor reacted
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@jay-kim The pictured error message is due to indentation issues on lines 7 and 9. You need to tab both of those so that they are within the calculate_average function. Python uses tabs to define where the action takes place. As you have it written, the return statement is out of scope for the global space.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/15/2023 11:58 pm
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@ssadvisor thanks for your advice. but didn't get what you meant. haha..

 
Posted : 07/16/2023 8:08 am
Share:
[the_ad_group id="312"]