How do I need to think about solving challenges?

Yeah but I can find Python forum on Reddit or other sites, without paying almost 10% of my salary for it. Codecademy as it is right now is just not for me.
Maybe I’ll come back when I’m ready for machine learning course but now I feel like it’s teaching me syntax but not what to do with it which is so frustrating that every once in a while I need some coding motivational video just to keep me wanting to learn code.

How do you use pythontutor? Whatever I paste in code editor I get just one step which doesn’t seem right. It just shows me that I am defining a function and that’s it, no way to see how it executes the code.

1 Like

I would experiment with it a bit. Put a solution that codecademy gives and see what it does with that for example. I have had it give me just a single step when I put in several lines of code. Putting the return in a function at wrong indent level may have been the cause. It doesn’t always give me clues, but I think it is a good tool for learning.

1 Like

After if condition you write an else condition to return the sum, because your code is valid for the below conditions

  1. If sum is greater than 9000
  2. If list is empty

You did not write code for the the condition what should be return if sum is less than 9000

You can change the code as follows

def over_nine_thousand(lst):
  sum = 0
  for num in lst:
      sum += num
      if sum > 9000:
          return sum
          return sum

If the list is empty, it will return sum as zero.

You right @levyrigor!! I can’t click NEXT until i read all community forum questions below the instructions!! They are very helpful, for exemple, in this one i just got familiar with the “Visualize your code” web app and “Automate boring stuff with Python” book! I also save some comments to bookmarks…

…once i read… “If it doesn’t challenge you, it won’t change you!” Challenge is change, and change to better hopefully!

Just keep coding @refined_silver!!! and reading forums!!

1 Like

Me the same,when you think like this, I think it’s the good time to pause and take a look back. What I did is :
Return back to the lesson, take note in an easiest way so you can look easier when you need ( like : how to use, when to use…). As simple as possible.
Try again every single concept that you need help before. If you still can’t solve it without hint, that could be the the missing piece you need. Take a look in forum, try to understand it. Take a break, solve it again the next day and so on, as soon as you get familiar with it.
Trust me I always use my notebook when I solve the new concepts, just look through every lesson to see what I can use and try it. Later I get used to and look no more.
More important than anything: Don’t give up and Keep moving forward!
Hope it can help.

I agree with this post, and if you start getting stressed out over a programming problem that you can’t seem to figure out at the time, it is better to walk away from it for a little bit. Regularly taking more time to think through the problem will help when you return to it later.

Can someone help me here with my code?

i = 0

for element in range(50):
    print(element + element[i])
    i += 1


My index i does not work. I get a TypeError. Can someone help me please ?

Are you sure that is what is not working?

Please tell us what your loop is accomplishing, or rather, what you wish it to accomplish.

I wish to print the fabonacci seqquence. So, each element before the element should be adding to the present element. So this element[i], I would like to represent this as the element before the present element in the loop but it is not working. I get a TypeError in the terminal

Have you studied what the sequence is and how it is generated? Would a range be the right tool for the job? What are the starting values? How large a sequence do you want?

tn = t(n-1) + t(n-2)

where n is not less than 3. Term 1 is 1, and term 2 is 1. (Term 1 may be 0.)


0 1 1 2 3 5 8 ...

1 1 2 3 5 8 13 ...

I got it, Thank you !

1 Like

Thank you so much for that link!! You are a life savior. When a bunch of new concepts are thrown at once I have to sit there for hours figuring out what is happening in the code. This makes life a lot easier.

There is no need for an else statement. You only need the if statement to implement the break condition. Since you always want to return the sum, this statement should go outside the for loop, so it is used in every possible scenario.

def over_nine_thousand(lst):

  sum = 0

  for i in lst:

    sum += i

    if sum >= 9000:


  return sum