Saturday, April 11, 2020

Answer for sum(list) [where list=[1,2,3,4] not working in exercise based ipynb files, as was shown during Class

https://365datascience.com/dwqa-answer/answer-for-sumlist-where-list1234-not-working-in-exercise-based-ipynb-files-as-was-shown-during-class/ -

Hi Satish!

Thanks for reaching out.

Your code is correct. I am referring to both


Numbers =[1, 5, 64, 24, 5]
sum(Numbers) 

and 


list_1=[1,2,3,4]
sum(list_1)

(for the latter, please not that ‘list’ is a keyword in Python, so it is not good to use it as a variable name as well. Adding a number, particularly for the purpose of this course, solves the problem quite well!).

What you need to do to solve the issue is execute the lines where you assign a value to the variable in question.

I.e. in your case, please execute Numbers =[1, 5, 64, 24, 5] first and only then execute sum(Numbers). Otherwise what you have is code, but please remember that without executing it, it stays like that – just code. We must always execute it for it to have an effect on our work.

Hope this helps.
Best,
Martin




#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy

No comments:

Post a Comment