More Turtles and a Guessing Game

CSCE 101 Lab 6

More Turtles and a Guessing Game

Academic Honesty

The work you turn in is to be your work, not copied from someone else or from the web.

Never allow anyone access to your files.

Never give anyone your password.

Never share your flash drive or email your files to anyone.

Never give anyone a printed copy of your file or an electronic copy.

Never allow anyone to copy your work.

General information

Read the entire assignment before you start.

We will be writing programs using Python 3. Please be sure to download and install the latest version of Python 3, if you have not already done this. Python for both Windows and Mac is available at: HYPERLINK “https://www.python.org/downloads/” https://www.python.org/downloads/

When you are in the lab, always work from your X: Drive on a computer in the lab, and copy your files you complete during the lab to your personal flash drive at the end of your lab class and every time you work on your assignments from a computer in the lab.

You have already created a folder named CSCE101 where you save your files on your X: drive. The instructors have READ ONLY permission to your X drive. They can see all of your files but cannot change anything on your X drive.

You must turn in a printed copy of the code for both Part A and Part B at the beginning of lab class in order to receive a grade for this lab assignment. Your files that you save on the X: Drive by the deadline must match the paper copies of Part A and Part B that you turn in to your lab instructor at the beginning of lab.

As a general reminder, always maintain backup copies of your work and remember to save frequently as you are working (in case of power outage, computer locking up, etc.).

The printers in the 244 and the 361 labs in the Sumwalt College Building are for printing CSCE 101 or 102 material only. It is not for printing notes, etc. for other classes or from the web, 101/102 only. The College of Engineering and Computing is keeping track of the number of pages that you use and can revoke your account for misuse.

If you click on the home drive icon on the desktop and do not click anything else and can see your 101 Lab folder in the open folder than your folder is in the correct place. If you then click on your 101 folder and without clicking anything else, you see your files, then your files are in the right place. Your Home drive is the xdrive. 

All sections with the exception of section 1, should have two Blackboard pages. a Supersite for lecture and the regular one for lab. Look for the Supersite.

If you are not in section 1 and do not have two blackboard pages for this course, please email both your lecture and lab instructors today!

Please remember that copying from the web is cheating and is a violation of Academic Integrity. You are to write your own code. Help is available! We will be posting more open hours all week so refresh the Open Hours Schedule page every time you open it.

Part A

A Guessing Game (lab6_XX.py):

Your program must include:

A comment on the top line of your program containing your name.

A comment on the second line containing your section number.

A comment on the third line containing the date.

A comment on the fourth line containing your email address.

A comment with the lab number and purpose of this lab.

Functionality

You will generate a random number between 50 and 100

You will repeatedly ask the user to guess a number between 50 and 100 until they guess the random number (you need use for/while loop here).

When their guess is too high – let them know

When their guess is too low – let them know

If they use more than 5 guesses, tell them they lose, you only get 5 guesses. And stop the game.

When they win, let them know how many guesses it took them

Sample Program

If the user doesn’t guess in 5 guesses, give them an error message.

Part B

Turtle Control II (lab6_XX_turtle.py):

In this section of the lab we will be writing expanding on the program from lab 5 that creates a turtle and allows you to control it with the keyboard as it moves about the screen.

You will be using the Python IDLE (a Python editor and programming environment that comes with python). Name your file lab6_XX_turtle.py where you replace the XX with your initials.

Your (turtle) program must include:

A comment on the top line of your program containing your name.

A comment on the second line containing your section number.

A comment on the third line containing the date.

A comment on the fourth line containing your email address.

A comment with the lab number and purpose of this lab.

Don’t forget to include import turtle on a line after the comments so you can use the various Turtle-related objects and methods.

Modify your program from lab 5 to cause the turtle to return to the center of the screen if it moves more than 300 units from the center of the screen.

Add a second turtle (named after your favorite animal) that is a different color and shape from the original turtle that moves randomly about the screen. It should begin facing a random direction and move at the speed of 1. Every 30 moves the turtle should turn a random direction and continue moving. If this turtle moves more than 300 units away from the center, it should teleport back to the center (0, 0) and continue moving. This turtle also should not leave a line behind it.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply