[Tutor] Questions on Python Programming in Context Third Edition
avi.e.gross at gmail.com
avi.e.gross at gmail.com
Thu Sep 15 12:04:37 EDT 2022
Judy,
Just FYI, just about everybody here is not in your class or has immediate
access to your textbook.
Your question SOUNDS LIKE you already have a function called "montePi " and
it can be called with one or more arguments directing what it does. I think
it is a Monte Carlo method for estimating the constant "pi".
Again, just as a guess, it sounds like the algorithm throws random darts at
a "square" target and tests how many fall within an inscribed circle. It can
do this umpteen times and then divide one sum from the other to determine a
ratio and so on and then determine what pi must be for that to happen. That
is not relevant though for the question.
The function sounds like it wants to be told how many random darts to throw.
You are asked to call the function twice. Once telling it to do 100,00
random darts and another time to do a million darts. Presumably the goal is
to see if you get more significant digits of pi correctly if you throw more
random numbers at the problem.
If I am write, this is only a Python problem if you are asking how to start
Python, make the function available and call it several times and examine
the output.
So do you know how to call a function in Python with one or more changes
such as sin(.5) and sin(.6) and what the way to call the montePi() function
is?
Again, I and most others cannot see the question so consider telling
anything you want anyone to see explicitly. No attachments either.
Avi
-----Original Message-----
From: Tutor <tutor-bounces+avi.e.gross=gmail.com at python.org> On Behalf Of
Judy Roberts via Tutor
Sent: Thursday, September 15, 2022 7:16 AM
To: tutor at python.org
Subject: [Tutor] Questions on Python Programming in Context Third Edition
I have a question on question # 2.36:
Run the montePi function using 100,000 and 1 million darts.
I am new to Python so struggling to find this answer. Can you enlighten me
on the process please?
Thank you in advance,
Judy Roberts
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list