Pythonic Algorithms 101

i think i have the code right, but it prints none, help!!!


i = 0
while True:
  i += 1
  if i == 100: 
      
    break
    
print i

op is

100
none

i put your code here:

https://repl.it/NuV8

there is no None, where do you get None?

2 Likes

FIRSTLY THANKS FOR YOUR TIME !!!

it prints 100 then none on the screen

But where are you running the code? Because i posted the repl, and there was no None, so it seems to be environment depended.

i understood from your first reply you get none in the output, but you need to help me narrow down the problem

2 Likes

image

i sent in an image, please look to the right in the image, in the black square, you’ll see:

100
none

I don’t know, but the none is bieng printed

What you are running is the old learning environment, which is no longer supported and maintained, so the whole exercise could be bugged.

The none is very likely caused by the exercise validation (SCT)

i would recommend the supported python course:

https://www.codecademy.com/learn/learn-python

Given you take such an outdated course, can you share me the url? Maybe i can have a look

2 Likes

i’m usu a few days late a few dollars short, really sorry to be a bother to you, thanks for helping me…

https://www.codecademy.com/courses/python-intermediate-en-NYXmc/0/2

i know what the problem is, CA wants me to spend money on their courses, i simply cannot afford to continue,

stetim94- I sincerely appreciate your helping me, but, please don’t put any more of your time into this thread.

thanks

Jackhg

but this course:

https://www.codecademy.com/learn/learn-python

is free

so why can’t you take that course?

1 Like

I checked, I did take this course, great course, I can’t afford to continue, it’s a CA biz model of give people a taste of what CA can do, namely this course, but then, CA will ask for monthly payments to continue

Well, the free tier is the regular lessons (this has always been), then later pro was added (paid tier) which included quizzes and freeform projects

1 Like

it seems the loop needs to end at zero, so you could go from 100 to 0 for example

1 Like

i = 100
while True:
i -= 1
if i == 0:
break

print i

yo! stetim94, it worked?? i still got 0,none, but it passed through, imagine that, thanks for the help!!! if one can afford CA pro, IMO this is the way to go, CA offers some great classes and amazing people as yourself… i don’t begrudge paying for CA courses, I simply do not have the funds to go pro—

Yea, the none is caused by the exercise validation. Nothing to worry about

well, you print i, so obviously you get the value of i (which is zero)

1 Like

Yep!! thanks again for the help, have a great day