RE: 01. LPTHW (A Good First Program - ex1.py) || Announcement of the winners of the last challenge. || New challenges at the end.

You are viewing a single comment's thread from:

01. LPTHW (A Good First Program - ex1.py) || Announcement of the winners of the last challenge. || New challenges at the end.

in python •  7 years ago  (edited)

Hey @bsameep! Please do format the code, makes it easier to read. :D

You can check the previous submissions for reference.

Also, the limit is 400000, not 40000.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hey sorry, but the code will work if u change 40000 to 400000... Here is the updated one...

len <- 100
fibvals <- numeric(len)

fibvals[1] <- 1
fibvals[2] <- 1
for (i in 3:len)
{
if(fibvals[i-1]+fibvals[i-2] > 400000)
{
break
}
else

fibvals[i] <- fibvals[i-1]+fibvals[i-2]
len = len+1

}

fibvals
sum(fibvals[fibvals %% 2 ==0])

Right now m holidaying at Western coastal area... Won't get chance to run d code n reproduce the answer...

Umm okay, do try formatting it for readability though.

Loading...