Help w/ easy python problem

Discussion in 'Python' started by r2_r2@hotmail.com, Sep 22, 2005.

  1. Guest

    I am very much a beginner to python. I have been working on writing a
    very simple program and cannot get it and was hoping someone could help
    me out. Basically i need to write a code to print a sin curve running
    down the page from top to bottom. The trick is I have to do this using
    only 7-8 lines of code. Any ideas?
    , Sep 22, 2005
    #1
    1. Advertising

  2. Guest

    Actually, it is not a sin curve i need to plot, it is dots running down
    the page in the shape of a sin curve like this

    ..
    .
    .
    etc...
    , Sep 22, 2005
    #2
    1. Advertising

  3. Guest

    Actually, it is not a sin curve i need to plot, it is dots running down
    the page in the shape of a sin curve like this

    ..
    .
    .
    etc...
    , Sep 22, 2005
    #3
  4. napisał(a):
    > Actually, it is not a sin curve i need to plot, it is dots running down
    > the page in the shape of a sin curve like this
    >
    > .
    > .
    > .
    > etc...
    >


    Seems, like a homework to me :)

    Anyway, use the following hints:

    math.sin() is your sine function, ranging, from -1.0 to 1.0 inclusively
    set up a for loop printing the strings containing spaces, and one dot at
    the appropriate location with:
    - the appropriate argument increase step between the lines (print
    statements)
    - the appropriate scaling of the <-1.0, 1.0> range into e.g. <0, 71>,
    representing the 72 characters wide lines being printed.

    Tomasz Lisowski
    Tomasz Lisowski, Sep 22, 2005
    #4
  5. wrote:
    > I am very much a beginner to python. I have been working on writing a
    > very simple program and cannot get it and was hoping someone could help
    > me out. Basically i need to write a code to print a sin curve running
    > down the page from top to bottom. The trick is I have to do this using
    > only 7-8 lines of code. Any ideas?



    This sounds like homework, and I think you should do that on your own.
    One hint, though: You could take a look at the standard module math.

    /MiO
    Mikael Olofsson, Sep 22, 2005
    #5
  6. wrote:
    > I am very much a beginner to python. I have been working on writing a
    > very simple program and cannot get it and was hoping someone could help
    > me out. Basically i need to write a code to print a sin curve running
    > down the page from top to bottom. The trick is I have to do this using
    > only 7-8 lines of code. Any ideas?
    >

    Yes : do your homework yourself. When you'll run into trouble with
    *your* code, then post here for help.


    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in ''.split('@')])"
    bruno modulix, Sep 22, 2005
    #6
    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. Hazzard
    Replies:
    2
    Views:
    623
    Hazzard
    Apr 6, 2004
  2. =?Utf-8?B?Y2hyaXM=?=
    Replies:
    3
    Views:
    454
    John Saunders
    Jun 1, 2004
  3. Paul Miller
    Replies:
    10
    Views:
    939
    Jeff Epler
    Jul 16, 2003
  4. Bruno Desthuilliers
    Replies:
    5
    Views:
    371
    Bruno Desthuilliers
    Aug 29, 2007
  5. Chris Seberino
    Replies:
    8
    Views:
    117
    Chris Seberino
    Jan 4, 2014
Loading...

Share This Page