As usual, create two directories for today's class. Create a
directory called lecture20
under activities, and
a directory called lab20
under labs.
Time to spin the wheel and find out what you will be submitting for your final portion of this weeks quiz grade.
Create a file called guessing_game.py
in your lecture20
directory. The program in this file should generate a random
number, and prompt the user to enter a guess of the number. The
user should be allowed to keep guessing until they get the guess correct.
Your program should indicate if the users guess is higher or lower than the randomly selected value.
I've been forcing you to do a lot of things this semester, and most of you are not sure exactly why. Let's spend some time exploring how to approach solving problems.
Read the following mini-assignment prompt. I will go through the "lazy" solution in class.
Create a program that draws a triangle and a random point and tests if the point is inside the triangle. The program should draw a triangle that takes up the majority of the window. You can pick the location of each of the corners, or vertices, of the triangle. The program should also generate and draw a random point in the window. The color of the circle should be determined by whether the point is inside or outside the triangle.
A point is inside a triangle if it is on the interior side of all three edges of the triangle. For example, the point P in the illustration below is on the interior side of the edge from B to C and the edge from C to A, but it is not on the interior side of the edge from A to B.