Search Results - JustLinux Forums


Search:

Type: Posts; User: mrBen

Search: Search took 0.62 seconds.

  1. Replies
    278
    Views
    669,112

    Doh! I read it as reversing every word that had...

    Doh! I read it as reversing every word that had an odd number of letters......


    Amended script:



    #!/usr/bin/python

    def isEven(number):
  2. Replies
    278
    Views
    669,112

    You forgot to reverse 'whats' in your example.......

    You forgot to reverse 'whats' in your example....

    Here is a Python solution - it's a bit clunky, but it works, and it only took a short while to code.



    #!/usr/bin/python

    def...
  3. Replies
    278
    Views
    669,112

    Now might be a good time to mention...

    Now might be a good time to mention http://www.pythonchallenge.com
  4. Replies
    278
    Views
    669,112

    or: Python 2.3.5 (#2, May 4 2005,...

    or:



    Python 2.3.5 (#2, May 4 2005, 08:51:39)
    [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> mystring = "She sells seas...
  5. Replies
    278
    Views
    669,112

    Can I just clarify - the array is of a user...

    Can I just clarify
    - the array is of a user defined length - so I need to include a means of him entering the length he wants?
    - When you say 'even' distibution, I am assuming you mean in a...
  6. Replies
    278
    Views
    669,112

    Cheers Strike; knew I could rely on you :D ...

    Cheers Strike; knew I could rely on you :D

    Python Rocks!
  7. Replies
    278
    Views
    669,112

    Another moment to stretch my Python fingers...

    Another moment to stretch my Python fingers again: (Amendments from Strike to follow ;) )



    #!/usr/bin/python

    import os, re

    inputfile="/home/mrben/input.txt"...
  8. Replies
    278
    Views
    669,112

    OK - this is a 5 minutes Python beginning (I'm at...

    OK - this is a 5 minutes Python beginning (I'm at work - don't have any more time). It converts an IP address to a 32bit (unsigned) hex number.

    It doesn't convert back yet, but it would take an...
  9. Replies
    278
    Views
    669,112

    Aha! That worked. :D I retract all my...

    Aha!

    That worked. :D

    I retract all my previous comments.
  10. Replies
    278
    Views
    669,112

    Probably because I'm running it at work under...

    Probably because I'm running it at work under Windows........
  11. Replies
    278
    Views
    669,112

    OK - played the game now. Couple of comments to...

    OK - played the game now. Couple of comments to make:

    1. It only accepts a single word, not a whole phrase - if you put in something like 'star wars' it only takes the first word.

    2. It...
  12. Replies
    278
    Views
    669,112

    Did anyone post the Python solution to this? It's...

    Did anyone post the Python solution to this? It's really neat:



    a,b = b,a


    Will swap the two :D I was dead impressed when I learnt that (I'm easily pleased)
  13. Replies
    278
    Views
    669,112

    In python range(x) gives you a list from 0 to x....

    In python range(x) gives you a list from 0 to x.

    In Python, your loop / condition ends at the next unindented line. Thus you always have pretty looking code ;)
  14. Replies
    278
    Views
    669,112

    My python attempt: [code] x=0 y=0 while...

    My python attempt:

    [code]
    x=0
    y=0
    while y<10000:
    y=0
    for loop in range(x):
    y+=x
    print y
Results 1 to 14 of 14