CPSC120A
Fundamentals of Computer Science I

Lab 8

Conditionals

Use the command line to create a new directory called lab8 in your labs directory. Make sure all of the .py files that you create for this activity are in that directory.

Point in Circle

Create a Python function called is_point_in_circle in a file called circle.py. The function should return True or False depending on whether a specified point is inside a specified circle. Note, exactly on the edge of the circle is considered inside. There should be parameters for the x and y coordinates of the point, for the x and y coordinates of the center of the circle, and for the radius of the circle. Be sure to test your function with points that are inside, outside, and on the edge.

Rock, Paper, Scissor

Create a Python program in a file called rock.py. The program should play the game Rock, Papers, Scissors. The program should prompt the user to enter their play, generate a random play for the computer, and print who won (and why). For example, one run of your program might look like this:

Enter your play (r, p, or s): r
Computer play is s.
Rock crushes scissors, you win!

Submission

Please show your source code and run your test cases for the instructor or lab assistant. Only a program that has perfect style, thorough test cases, and flawless functionality will be accepted as complete.