Small program ideas

Discussion in 'Python' started by eli m, Feb 16, 2013.

  1. eli m

    eli m Guest

    Any small program ideas? I would prefer to stick to command line ones. Thanks.
     
    eli m, Feb 16, 2013
    #1
    1. Advertising

  2. On 02/15/2013 10:22 PM, eli m wrote:
    > Any small program ideas? I would prefer to stick to command line ones. Thanks.


    How about these two:

    - simulation of a street crossing with green/red lights allowing cars
    and pedestrians to pass in one direction then another

    - simulation of an elevator in a building: buttons on each floor to
    call the elevator, buttons inside to go to a particular floor,
    multiple floors can be selected at the same time, creating a queue
    of floors to go to.

    -m

    --
    Lark's Tongue Guide to Python: http://lightbird.net/larks/
     
    Mitya Sirenef, Feb 16, 2013
    #2
    1. Advertising

  3. eli m

    eli m Guest

    On Friday, February 15, 2013 7:52:57 PM UTC-8, Mitya Sirenef wrote:
    > On 02/15/2013 10:22 PM, eli m wrote:
    >
    > > Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >
    >
    >
    > How about these two:
    >
    >
    >
    > - simulation of a street crossing with green/red lights allowing cars
    >
    > and pedestrians to pass in one direction then another
    >
    >
    >
    > - simulation of an elevator in a building: buttons on each floor to
    >
    > call the elevator, buttons inside to go to a particular floor,
    >
    > multiple floors can be selected at the same time, creating a queue
    >
    > of floors to go to.
    >
    >
    >
    > -m
    >
    >
    >
    > --
    >
    > Lark's Tongue Guide to Python: http://lightbird.net/larks/


    Could i make these text and not visual? That is what i am trying to do.
     
    eli m, Feb 16, 2013
    #3
  4. eli m

    eli m Guest

    On Friday, February 15, 2013 7:52:57 PM UTC-8, Mitya Sirenef wrote:
    > On 02/15/2013 10:22 PM, eli m wrote:
    >
    > > Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >
    >
    >
    > How about these two:
    >
    >
    >
    > - simulation of a street crossing with green/red lights allowing cars
    >
    > and pedestrians to pass in one direction then another
    >
    >
    >
    > - simulation of an elevator in a building: buttons on each floor to
    >
    > call the elevator, buttons inside to go to a particular floor,
    >
    > multiple floors can be selected at the same time, creating a queue
    >
    > of floors to go to.
    >
    >
    >
    > -m
    >
    >
    >
    > --
    >
    > Lark's Tongue Guide to Python: http://lightbird.net/larks/


    Could i make these text and not visual? That is what i am trying to do.
     
    eli m, Feb 16, 2013
    #4
  5. On 02/15/2013 10:57 PM, eli m wrote:
    > On Friday, February 15, 2013 7:52:57 PM UTC-8, Mitya Sirenef wrote:
    >> On 02/15/2013 10:22 PM, eli m wrote:
    >>
    >>> Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >>
    >>
    >> How about these two:
    >>
    >>
    >>
    >> - simulation of a street crossing with green/red lights allowing cars
    >>
    >> and pedestrians to pass in one direction then another
    >>
    >>
    >>
    >> - simulation of an elevator in a building: buttons on each floor to
    >>
    >> call the elevator, buttons inside to go to a particular floor,
    >>
    >> multiple floors can be selected at the same time, creating a queue
    >>
    >> of floors to go to.
    >>
    >>
    >>
    >> -m
    >>
    >>
    >>
    >> --
    >>
    >> Lark's Tongue Guide to Python: http://lightbird.net/larks/

    > Could i make these text and not visual? That is what i am trying to do.



    Of course - just think up some textual representation before starting on
    the code. -m

    --
    Lark's Tongue Guide to Python: http://lightbird.net/larks/
     
    Mitya Sirenef, Feb 16, 2013
    #5
  6. eli m

    eli m Guest

    On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:
    > Any small program ideas? I would prefer to stick to command line ones. Thanks.


    Thank you guys for the suggestions. Any more?
     
    eli m, Feb 26, 2013
    #6
  7. eli m

    Dave Angel Guest

    On 02/25/2013 10:48 PM, eli m wrote:
    > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:
    >> Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >
    > Thank you guys for the suggestions. Any more?
    >


    There are all kinds of things you could do. First, consider something
    that might be useful.

    1) checksum all the files in a directory tree, using various checksum
    algorithms.

    2) Convert one kind of file to another.

    3) Calculate time between two dates

    4) Write some part of a backup system. For example, copy files from a
    directory tree into a specified directory, stopping when the size totals
    N.N gig, and keeping track of which files have been so processed, so
    that after burning that directory to DVD, you can repeat the process.
    As a bonus, add a utility & datafile to the top of that directory, so
    that the DVD can be self-checking.

    Then try something interesting:

    1) find the nth prime, for example the 1000th prime

    2) Find all perfect numbers under a trillion

    3) solve the puzzles on http://projecteuler.net

    4) Build a spell checker, using a combination of a standard
    dictionary-list and custom entries. Bonus question - Make it smart
    enough to only spell-check comments and literal strings, when applied to
    files with an extension of .py


    --
    DaveA
     
    Dave Angel, Feb 26, 2013
    #7
  8. eli m

    Vytas D. Guest

    Hello,

    Some more ideas:

    1. Implement sin(), cos(), tan() etc. The accuracy could be supplied as a
    parameter to the program. The correctness can be checked very easily with
    implemented versions.

    2. Read a string/file and look for palindromes (the group of words that can
    read from both ends: A toyota, Madam in Eden, I'm Adam...)

    3. Read a string/file and draw that string on the screen in a whirlpool
    way. Counter-clockwise sample of the string: "abigsnake":
    sgi
    nab
    ake

    4. Print first n Fibonacci numbers.

    5. Calculate Pi value for the specified accuracy. From wiki: "...
    irrational number, including ð, can be represented by an infinite series of
    nested fractions...". So it won't be very complicated to implement.

    6. Implement dos2unix/unix2dos

    7. Calculator, that gets a string, put data into a tree and after
    calculates the value.

    Vytas D.


    On Tue, Feb 26, 2013 at 6:15 AM, Dave Angel <> wrote:

    > On 02/25/2013 10:48 PM, eli m wrote:
    >
    >> On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:
    >>
    >>> Any small program ideas? I would prefer to stick to command line ones.
    >>> Thanks.
    >>>

    >>
    >> Thank you guys for the suggestions. Any more?
    >>
    >>

    > There are all kinds of things you could do. First, consider something
    > that might be useful.
    >
    > 1) checksum all the files in a directory tree, using various checksum
    > algorithms.
    >
    > 2) Convert one kind of file to another.
    >
    > 3) Calculate time between two dates
    >
    > 4) Write some part of a backup system. For example, copy files from a
    > directory tree into a specified directory, stopping when the size totals
    > N.N gig, and keeping track of which files have been so processed, so that
    > after burning that directory to DVD, you can repeat the process. As a
    > bonus, add a utility & datafile to the top of that directory, so that the
    > DVD can be self-checking.
    >
    > Then try something interesting:
    >
    > 1) find the nth prime, for example the 1000th prime
    >
    > 2) Find all perfect numbers under a trillion
    >
    > 3) solve the puzzles on http://projecteuler.net
    >
    > 4) Build a spell checker, using a combination of a standard
    > dictionary-list and custom entries. Bonus question - Make it smart enough
    > to only spell-check comments and literal strings, when applied to files
    > with an extension of .py
    >
    >
    > --
    > DaveA
    > --
    > http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
    >
     
    Vytas D., Feb 26, 2013
    #8
  9. eli m

    Matej Cepl Guest

    On 2013-02-26, 03:48 GMT, eli m wrote:
    > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:
    >> Any small program ideas? I would prefer to stick to command line
    >> ones. Thanks.

    >
    > Thank you guys for the suggestions. Any more?


    1) Clone git repository from https://github.com/mcepl/html2text
    2) Switch to fix_tests branch
    3) Fix all tests running the testsuite with python3.3

    You will help a good thing, contribute to the Aaron Swartz memory (yes,
    *that* Aaron Swartz is the original author of the module), and learn
    about python more than by any silly simple demos (hint: pdb is your
    friend).

    It is not difficult, just time consuming.

    Best,

    Matěj
     
    Matej Cepl, Feb 26, 2013
    #9
  10. eli m

    Neil Cerutti Guest

    On 2013-02-26, Vytas D. <> wrote:
    > Some more ideas:


    If you like puzzles but not math, then The Python Challenge is an
    interesting destination. You'll be thrown head first into Python
    libraries you might not otherwise not be interested, like PIL.
    Command line apps are not the norm in the challenge.

    http://www.pythonchallenge.com/

    --
    Neil Cerutti
     
    Neil Cerutti, Feb 26, 2013
    #10
  11. eli m

    eli m Guest

    On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
    > On 02/25/2013 10:48 PM, eli m wrote:
    >
    > > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

    >
    > >> Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >
    > >

    >
    > > Thank you guys for the suggestions. Any more?

    >
    > >

    >
    >
    >
    > There are all kinds of things you could do. First, consider something
    >
    > that might be useful.
    >
    >
    >
    > 1) checksum all the files in a directory tree, using various checksum
    >
    > algorithms.
    >
    >
    >
    > 2) Convert one kind of file to another.
    >
    >
    >
    > 3) Calculate time between two dates
    >
    >
    >
    > 4) Write some part of a backup system. For example, copy files from a
    >
    > directory tree into a specified directory, stopping when the size totals
    >
    > N.N gig, and keeping track of which files have been so processed, so
    >
    > that after burning that directory to DVD, you can repeat the process.
    >
    > As a bonus, add a utility & datafile to the top of that directory, so
    >
    > that the DVD can be self-checking.
    >
    >
    >
    > Then try something interesting:
    >
    >
    >
    > 1) find the nth prime, for example the 1000th prime
    >
    >
    >
    > 2) Find all perfect numbers under a trillion
    >
    >
    >
    > 3) solve the puzzles on http://projecteuler.net
    >
    >
    >
    > 4) Build a spell checker, using a combination of a standard
    >
    > dictionary-list and custom entries. Bonus question - Make it smart
    >
    > enough to only spell-check comments and literal strings, when applied to
    >
    > files with an extension of .py
    >
    >
    >
    >
    >
    > --
    >
    > DaveA


    How hard would it be to change one file to another and would it be a small-medium sized program?
     
    eli m, Feb 26, 2013
    #11
  12. eli m

    eli m Guest

    On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
    > On 02/25/2013 10:48 PM, eli m wrote:
    >
    > > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

    >
    > >> Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >
    > >

    >
    > > Thank you guys for the suggestions. Any more?

    >
    > >

    >
    >
    >
    > There are all kinds of things you could do. First, consider something
    >
    > that might be useful.
    >
    >
    >
    > 1) checksum all the files in a directory tree, using various checksum
    >
    > algorithms.
    >
    >
    >
    > 2) Convert one kind of file to another.
    >
    >
    >
    > 3) Calculate time between two dates
    >
    >
    >
    > 4) Write some part of a backup system. For example, copy files from a
    >
    > directory tree into a specified directory, stopping when the size totals
    >
    > N.N gig, and keeping track of which files have been so processed, so
    >
    > that after burning that directory to DVD, you can repeat the process.
    >
    > As a bonus, add a utility & datafile to the top of that directory, so
    >
    > that the DVD can be self-checking.
    >
    >
    >
    > Then try something interesting:
    >
    >
    >
    > 1) find the nth prime, for example the 1000th prime
    >
    >
    >
    > 2) Find all perfect numbers under a trillion
    >
    >
    >
    > 3) solve the puzzles on http://projecteuler.net
    >
    >
    >
    > 4) Build a spell checker, using a combination of a standard
    >
    > dictionary-list and custom entries. Bonus question - Make it smart
    >
    > enough to only spell-check comments and literal strings, when applied to
    >
    > files with an extension of .py
    >
    >
    >
    >
    >
    > --
    >
    > DaveA


    How hard would it be to change one file to another and would it be a small-medium sized program?
     
    eli m, Feb 26, 2013
    #12
  13. On 26 February 2013 22:47, eli m <> wrote:

    > How hard would it be to change one file to another and would it be a
    > small-medium sized program?
    >


    How do you want to change it? Like rename a file (os.rename)?
     
    Joshua Landau, Feb 27, 2013
    #13
  14. eli m

    eli m Guest

    On Tuesday, February 26, 2013 4:22:10 PM UTC-8, Joshua Landau wrote:
    > On 26 February 2013 22:47, eli m <> wrote:
    >
    >
    >
    >
    >
    > How hard would it be to change one file to another and would it be a small-medium sized program?
    >
    >
    > How do you want to change it? Like rename a file (os.rename)?


    I want to change the file type.
     
    eli m, Feb 27, 2013
    #14
  15. eli m

    eli m Guest

    On Tuesday, February 26, 2013 4:22:10 PM UTC-8, Joshua Landau wrote:
    > On 26 February 2013 22:47, eli m <> wrote:
    >
    >
    >
    >
    >
    > How hard would it be to change one file to another and would it be a small-medium sized program?
    >
    >
    > How do you want to change it? Like rename a file (os.rename)?


    I want to change the file type.
     
    eli m, Feb 27, 2013
    #15
  16. eli m

    Dave Angel Guest

    On 02/26/2013 05:47 PM, eli m wrote:
    > On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
    >> On 02/25/2013 10:48 PM, eli m wrote:
    >>
    >>> On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

    >>
    >>>> Any small program ideas? I would prefer to stick to command line ones. Thanks.

    >>
    >>>

    >>
    >>> Thank you guys for the suggestions. Any more?

    >>
    >>>

    >>
    >>
    >>
    >> There are all kinds of things you could do. First, consider something
    >>
    >> that might be useful.
    >>
    >>
    >>
    >> 1) checksum all the files in a directory tree, using various checksum
    >>
    >> algorithms.
    >>
    >>
    >>
    >> 2) Convert one kind of file to another.
    >>
    >> <snip>
    >>

    >
    > How hard would it be to change one file to another and would it be a small-medium sized program?
    >


    Depends on the kinds of the two files. To convert an Excel spreadsheet
    file to a csv file might be a lot of work, thousands of lines, not to
    mention having to dig up the docs. But to convert a DOS text file (with
    lines ending cr/lf) into a Unix text file (with lines ending lf) would
    be a dozen lines, shrinkable to 3 with lots of experience. (And I'd
    probably prefer the dozen line version)

    Other conversions might be somewhere in between. You could do data
    compression, like bzip, using the modules in the standard library.

    Note that utility commands may exist, but it can be instructive to do it
    "by hand" anyway, to learn how.

    Look at the following libraries, and see how you could write the glue to
    make them into useful file conversion utilities. Then test them against
    the standard equivalents, to make sure your code really work.
    alib, gzip, bz2, zipfile, tarfile, csv, ConfigParser, robotparser, ...



    --
    DaveA
     
    Dave Angel, Feb 27, 2013
    #16
  17. On Wed, Feb 27, 2013 at 2:27 PM, Dave Angel <> wrote:
    > But to convert a DOS text file (with lines ending cr/lf) into a Unix text
    > file (with lines ending lf) would be a dozen lines, shrinkable to 3 with
    > lots of experience. (And I'd probably prefer the dozen line version)


    Code golf!

    open("outfile","wb").write(open("infile","rb").read().replace("\r",""))

    No particular reason, and I'd probably prefer a 3-6 line version of
    it, but it's fun to do it as one :)

    ChrisA
     
    Chris Angelico, Feb 27, 2013
    #17
  18. eli m

    eli m Guest

    Any other ideas?
     
    eli m, Mar 18, 2013
    #18
  19. On 18/03/2013 23:51, eli m wrote:
    > Any other ideas?
    >


    How about coming up with a new message passing syntax for objects? I
    understand from recent postings that this should be fairly easy :)

    --
    Cheers.

    Mark Lawrence
     
    Mark Lawrence, Mar 19, 2013
    #19
  20. eli m

    PMT Guest

    Em sábado, 16 de fevereiro de 2013 03h22min41s UTC, eli m escreveu:
    > Any small program ideas? I would prefer to stick to command line ones. Thanks.


    What about this one?

    Do you know how to do the elevator simulation?
     
    PMT, Mar 28, 2013
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason  Taylor

    Ideas for first program?

    Jason Taylor, Aug 31, 2007, in forum: C++
    Replies:
    3
    Views:
    371
    Jude Naveen Pinto
    Aug 31, 2007
  2. George Ogata

    Ideas for program

    George Ogata, Mar 10, 2006, in forum: Ruby
    Replies:
    3
    Views:
    125
    Gregory Brown
    Mar 10, 2006
  3. Diego Virasoro

    ideas for a "parameter sweep" program?

    Diego Virasoro, Nov 23, 2009, in forum: Ruby
    Replies:
    10
    Views:
    208
    Diego Virasoro
    Nov 24, 2009
  4. Chris

    Small improvements ideas ?

    Chris, Sep 8, 2010, in forum: Ruby
    Replies:
    6
    Views:
    118
    Chris
    Sep 9, 2010
  5. Jasper
    Replies:
    17
    Views:
    206
    David H. Adler
    Jul 8, 2004
Loading...

Share This Page