# Project Euler 4: (Iron)Python

Filed under:
|
|
|
##### python

In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 4

As always, any feedback is welcome.

```# Euler 4
# http://projecteuler.net/index.php?section=problems&id=4
# Find the largest palindrome made from the product of
# two 3-digit numbers. A palindromic number reads the
# same both ways. The largest palindrome made from the
# product of two 2-digit numbers is 9009 = 91 x 99.
# Find the largest palindrome made from the product of
# two 3-digit numbers.
import time
start = time.time()

def isPalindrome(s):
return s == s[::-1]

max = 0
for i in xrange(100, 999):
for j in xrange(i, 999):
n = i * j;
if (isPalindrome(str(n))):
if (n > max): max = n

print max

print "Elapsed Time:", (time.time() - start) * 1000, "millisecs"
a=raw_input('Press return to continue')
```

© Johnny Coder or respective owner

### Related posts about ironpython

• #### Calling C# object method from IronPython

as seen on Stack Overflow - Search for 'Stack Overflow'
I'm trying to embed a scripting engine in my game. Since I'm writing it in C#, I figured IronPython would be a great fit, but the examples I've been able to find all focus on calling IronPython methods in C# instead of C# methods in IronPython scripts. To complicate things, I'm using Visual Studio… >>> More

• #### Why is IronPython faster than the Official Python Interpreter

as seen on Stack Overflow - Search for 'Stack Overflow'
According to this: http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IP20VsCPy25Perf&referringTitle=IronPython%20Performance IronPython (Python for .Net) is faster than regular Python (cPython) on the same machine. Why is this? I would think compiled C code would always be faster than… >>> More

• #### Name some non-trivial sites written using IronPython & Silverlight

as seen on Stack Overflow - Search for 'Stack Overflow'
Just what the title says. It'd be nice to know a few non-trivial sites out there using Silverlight in Python. >>> More

• #### Embedding IronPython in a WinForms app and interrupting execution

as seen on Stack Overflow - Search for 'Stack Overflow'
BACKGROUND I've successfully embedded IronPython in my WinForm apps using techniques like the one described here: http://blog.peterlesliemorris.com/archive/2010/05/19/embedding-ironpython-into-a-c-application.aspx In the context of the embedding, my user may any write loops, etc. I'm using the IronPython… >>> More

• #### Distributing IronPython applications - how to detect the location of ipyw.exe

as seen on Stack Overflow - Search for 'Stack Overflow'
I'm thinking of developing a small application using Iron python, however I want to distribute my app to non-techies and so ideally I want to be able to give them a standard shortcut to my application along with the instructions that they need to install IronPython first. If possible I even want… >>> More

### Related posts about languages

• #### Programming languages, positional languages and natural languages

as seen on Programmers - Search for 'Programmers'
Some programming languages are modeled on machine code, like assembly languages. Other languages are modeled on a natural language, the English language. Others are not modeled on either machine code or natural language. Languages such as PROLOG, for example, don't follow either model. I came across… >>> More

• #### Dynamic type languages versus static type languages

as seen on Stack Overflow - Search for 'Stack Overflow'
What are the advantages and limitations of dynamic type languages compared to static type languages? See also: whats with the love of dynamic languages (a far more argumentative thread...) >>> More

• #### Are Mark Up languages considered programming languages?

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi Are all those markup languages programming languages? For example XML or HTML are programming languages? >>> More

• #### Managed Languages vs Compiled Language difference?

as seen on Programmers - Search for 'Programmers'
I get confused when people try to make a distinction between compiled languages and managed languages. From experience, I understand that most consider compiled languages to be C,C++ while managed languages are Java,C# (There are obviously more, but these are just few examples). But what exactly is… >>> More

• #### Advantages of compilers for functional languages over compilers for imperative languages

as seen on Stack Overflow - Search for 'Stack Overflow'
As a follow up to this question What are the advantages of built-in immutability of F# over C#?--am I correct in assuming that the F# compiler can make certain optimizations knowing that it's dealing with largely immutable code? I mean even if a developer writes "Functional C#" the compiler wouldn't… >>> More