Homework 3-1

Due April 9, 2013, 2:25 pm

Task 1

For the first part of this assignment, we will review and practice Python skills by doing a lot simple tasks which cultimate in a function that encrypts a message. Complete these tasks by answering the questions and filling out the stencil code in HW3-1.py. You will find instructions in the form of comments.

The idea of this simple encryption scheme is this: You keep a secret number, called n. You take a message, and change each letter to a new one that is n letter(s) ahead of it on the alphabet (wrapping around to A if you go past Z). For example, encrypting

"to be or not to be"
using number 1 will give you
"up cf ps opu up cf"

To decrypt a message, someone will need to know your secret number, and reverse this process.

Task 2

A random guessing game consists of 100 coin flips. The score is the number of heads. For this part, you want to answer the question: if I play this game 1000 times, what percentage of times do I get a score higher than 62? Write a function called coinflipper() to answer this question. Put it at the bottom of your HW3-1.py file.

Here are steps to guide you through the process of answering this question. If you are confident enough, you should try to break the task down into steps yourself.

Reminders:

Handin

Rename your program file to YourName_HW3-1.py and email it to cs0931handin@gmail.com.