Help w/ easy python problem

R

r2_r2

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?
 
R

r2_r2

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...
 
R

r2_r2

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...
 
T

Tomasz Lisowski

(e-mail address 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
 
M

Mikael Olofsson

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
 
B

bruno modulix

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top