-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheuler2.py
More file actions
34 lines (24 loc) · 765 Bytes
/
Copy patheuler2.py
File metadata and controls
34 lines (24 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#This function check is a number even or not
#And return true if a number is even
def even(num):
if num % 2 == 0:
return True
else:
return False
#Defind variables
counter = 0
seccond_number = 2
first_number = 1
next_number = 0
while (first_number < 4000000):
#Update counter step
#Get fib number with collect first number and seccond number
next_number = first_number + seccond_number
#Assign new number to variable
first_number = seccond_number
seccond_number = next_number
#Check if fib number is even or Not!
if (even(next_number) == True):
counter += next_number
#Print final resualt
print(counter)