Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Fawzy
Ahmed-Fawzy / problem20_euler.py
Created May 5, 2014 02:23
Project Euler - problem 20
#!/usr/bin/python
number = 100
n = 100
fact = 1
while number > 0 :
fact *= number
number -= 1
@Ahmed-Fawzy
Ahmed-Fawzy / problem2_euler.py
Created May 5, 2014 02:10
Project Euler - Problem 2
#!/usr/bin/python
End = 4000000
Sum = 2
back = 1
current = 2
def is_even(n):
return n % 2 == 0
@Ahmed-Fawzy
Ahmed-Fawzy / problem12_euler.py
Created May 4, 2014 09:35
project euler problem12 - this script takes too long time to solve problem
#!/usr/bin/python
#this script takes long time to get the first number that has 500 divisors
number = 0
for i in range(1,10000):
number += i
s = 0
for x in range(1,number+1):
if number % x == 0 :
@Ahmed-Fawzy
Ahmed-Fawzy / age.py
Last active August 29, 2015 14:00
calculate age in years, days, hours, minutes and seconds with auto update
#!/usr/bin/python
# Thiss script calculate age in years, days, hours, minutes and seconds with auto update
# Emad Elsaid's ruby script inspired me to write this script
#ruby script link : https://gist.github.com/blazeeboy/9185583
import time, datetime
date_of_birth = '1988-4-18'
#!/usr/bin/python
aaa = ['4','2','5']
bbb = ['4','2','5']
for i in range(len(aaa)):
if aaa[i] == bbb[i] :
print "matched"
else:
print "unmatched"