You are viewing a single comment's thread from:

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

in #python7 years ago

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])

Sort:  

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...

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63493.34
ETH 2578.53
USDT 1.00
SBD 2.79