So I have continued on with the course, just getting answers and studying where I get stuck, it is making MUCH more sense ( this is my personal experience) so perhaps the questions are in the wrong order?
As for someone who has never looked at a coding language in their lives and just started Python yesterday with codecademy. It so far has been extremely fun! everything has been VERY straight forward and codecademy has definitely held my hand along the way!
This specific question as a COMPLETE beginner overwhelmed with terms (in a good way).
The instructions : " The function should double the value of the element at
lst" its asking us to double the funtion?
In the most basic NOOB explanation of how thus far I understand functions (only 33% into this course) is that a “function” is a little “block of code” that we can “call” upon “to do something”. So the wording here is confusing to me personally, Why/how do I double the thing that I just call upon “to do something”
Below is the answer so I could understand what a PRO did! Again more problems for me! ( as I have continued in the course looking at this is starting to make more sense)
the “lst[index] = lst[index] * 2” confused the HECK outta me! what does “lst[index]” even do? Is it a variable? and why? The square brackets are JUST introduced in learning lists with python and from what we learn this would be a list named “lst” which I guess would be “[3, 8, -10, 12] = [3, 8, -10, 12] x 2”
#Write your function here
def double_index(lst, index):
if index < len(lst):
lst[index] = lst[index] * 2
#Uncomment the line below when your function is done
print(double_index([3, 8, -10, 12], 2))
As a pro reading what a noob understands is probably frustrating! Thanks for taking the time to talk to us and I hope I helped if others are confused on the wording as well!