We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dab312e commit 362270cCopy full SHA for 362270c
project_euler/problem_02/sol1.py
@@ -18,9 +18,7 @@
18
j=2
19
sum=0
20
while(j<=n):
21
- if((j&1)==0): #can also use (j%2==0)
+ if j%2 == 0:
22
sum+=j
23
- temp=i
24
- i=j
25
- j=temp+i
+ i , j = j, i+j
26
print(sum)
project_euler/problem_02/sol3.py
@@ -12,9 +12,7 @@
12
b=2
13
count=0
14
while 4*b+a<n:
15
- c=4*b+a
16
- a=b
17
- b=c
- count=count+a
+ a, b = b, 4*b+a
+ count+= a
print(count+b)
0 commit comments