[Tutor] Python problem
Moore, Colleen
moore.3972 at buckeyemail.osu.edu
Sun Oct 9 19:42:04 EDT 2022
Hi, I figured I could post a question here that I wasn't sure how to solve. Below are the problems:
Question 2. Write a Python program to create a list of 1000 random points. These points must be objects of the Point class. The X and Y coordinates of these points must be random float between a range and any arbitrary range will be fine. (Hint: random.uniform can be used to generate a random floating point value between any two given numbers.)
Question 3. After you finish the above, write a program to print out the number of points that fall in the left half of the area. If a point is exactly on the middle of the area, you are free to decide to either count it in the left half, or right half. Please note in your program how which is the case.
Question 4. Write a Python program to draw the points for the above question. Points counted as falling into the left are rendered in darkgrey and right in lightgrey. Submit both your code and a screenshot of the plotting result.
Thanks!
More information about the Tutor
mailing list