Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Help w/ easy python problem

Reply
Thread Tools

Help w/ easy python problem

 
 
r2_r2@hotmail.com
Guest
Posts: n/a
 
      09-22-2005
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?

 
Reply With Quote
 
 
 
 
r2_r2@hotmail.com
Guest
Posts: n/a
 
      09-22-2005
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...

 
Reply With Quote
 
 
 
 
r2_r2@hotmail.com
Guest
Posts: n/a
 
      09-22-2005
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...

 
Reply With Quote
 
Tomasz Lisowski
Guest
Posts: n/a
 
      09-22-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
Mikael Olofsson
Guest
Posts: n/a
 
      09-22-2005
(E-Mail Removed) 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
 
Reply With Quote
 
bruno modulix
Guest
Posts: n/a
 
      09-22-2005
(E-Mail Removed) 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 '(E-Mail Removed)'.split('@')])"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it reasonably easy easy to something like this with python? Bruno Desthuilliers Python 5 08-29-2007 07:40 AM
Stripping audio from qa DVD. Easy or not so easy? GJ Computer Support 1 05-23-2007 02:03 AM
easy to look at and easy to maintain web page menuing system. Hazzard ASP .Net 2 04-06-2004 03:51 AM
How to crash Python in 1 easy step (python 2.2.2) Paul Miller Python 10 07-16-2003 03:28 PM



Advertisments