Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP 1405/1005 (Fall 2022) − "Introduction to Computer Science I"

Tutorial 05 of 10

Your submission for this tutorial must include your full name and you nine-digit student number as a comment at the top of every source file you submit. All source code files must be written using the Python 3 programming language and must run on the course's official virtual machine.

Exercise A: "Prime Numbers"

For this exercise you will design and implement a function (and not just a program) that takes a single integer as an argument and has a Boolean return value. This function should only return True if and only if the integer passed as an argument is a prime number. Prime numbers are integers strictly greater than one that can only be evenly divided (i.e., long divided without producing a remainder) by themselves and the value 1. After you have written this function, write a program with a loop that allows the user to repeatedly input a number and receive feedback about whether or not that number is a prime number, ensuring the user always has the option to end the program.

In order to complete this task, you will need to:

.   devise a test for "primeness" that will use a looping control structure and modulation

Your submission for this exercise:

.   must be a source code file with filename1    'comp1405_f22_#########_tutorial_05_a.py'

.   must use a counter-controlled loop to determine if a number is prime or not

.   must include a prime number function with one integer argument and one Boolean return

.   must use the correct loop for an interface that allows the user use the function repeatedly

Exercise B: "Simple Games"

For this exercise you will design and implement a program (again using functions that you write yourself) that allows the user to play either "Rock-Paper-Scissors" or "Tic-Tac-Toe" (but not both) with a computer player. Both of these games can be played randomly by a computer player, but if your are feeling particularly ambitious, it isn't difficult to get an artificial Tic-Tac-Toe player to play slightly better than randomly....

In order to complete this task, you will need to:

.   ensure you know how "Rock-Paper-Scissors" and/or "Tic-Tac-Toe" are played

Your submission for this exercise:

.   must be a source code file with filename   'comp1405_f22_#########_tutorial_05_b.py'

.   must include a "main" function that is called at the end of your program

.   must have the remaining functionality organized into separate functions

.   must ensure that the user input is always a valid option for your game

.