Pythonic Algorithms 101


#1

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


#2

i put your code here:

https://repl.it/NuV8

there is no None, where do you get None?


#3

FIRSTLY THANKS FOR YOUR TIME !!!

it prints 100 then none on the screen


#4

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


#5

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


#6

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


#7

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


#8

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


#9

but this course:

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

is free

so why can’t you take that course?


#10

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


#11

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


#12

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


#13

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—


#14

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)


#15

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


#16