Python Performance Based Final

Select five projects from the 1-10 and one project from 11-14 below and complete the tasks in Python. Save each project with FinalProject(Question#). For Example: FinalProject3 if I select number 3 below

Save all work into your Class folder

 

1. The Meal

You've finished eating at a restaurant, and received this bill:

Use Python to calculate the tip. Apply the tip to the overall cost of the meal (including tax).

2. Pyg Latin

Use Python to write a Pig Latin translator. Pig Latin is a language game, where you move the first letter of the word to the end and add "ay." So "Python" becomes "ythonpay." To write a Pig Latin translator in Python, here are the steps we'll need to take:

  1. Ask the user to input a word in English.
  2. Make sure the user entered a valid word.
  3. Convert the word from English to Pig Latin.
  4. Display the translation result.

3. Converter

Use Python to write a program that converts feet to yards.

4. Reverse

Write a python program that accept a word from the user and reverse it.

5. Factorial

Use Python to find the factorial of a number. The factorial of a number is the product of all the integers from 1 to that number. For example, the factorial of 6 (denoted as 6!) is 1*2*3*4*5*6 = 720. Factorial is not defined for negative numbers and the factorial of zero is one, 0! = 1.

6. Prime

Use Python to write a program that checks to see if a number inputted is Prime.

7. Duplicates

Use Python to write a program to remove duplicates from a list.

8. Fibonacci

Use Python to write a program that computes and displays the first 15 numbers in the Fibonacci sequence. (1, 1, 2, 3, 5, 8, 13, 21, 34, 55 , 89, 144, 233, 377, 610)

9. Average Calculator

Create a calculator that will calculate the average of numbers input. The user should be able to enter a set of numbers and the program should calculate the mode, median, and mean and outout all three.

10. Number of Letters

Write a program that accepts a sentence and calculate the number of letters and digits.
Suppose the following input is supplied to the program:
hello world! 123
Then, the output should be:
LETTERS 10
DIGITS 3

11. Connect 4

This game is similar to Tic-Tac-Toe, however the board is larger, but amount of possible moves is limited.

Imagine that the board is set vertically (rather than laying flat), and each player at his turn can put his mark only on the top of any columns. In "physical" version color discs are simply dropped from the top.

The goal is to make the line of 4 or more marks - horizontal, vertical or diagonal. Original game field is 7x6 (with 7 columns). We will use a larger field of 9x8.

It is up to you to choose if you want a two player game or an AI game. Write a program for this game.

12. Rock Paper Scissors

There is a game which is of special importance in the Computer Science because it though simple itself, could be used for creating very cunning Artificial Intelligence algorithms to play against human (or each other) with predicting the opponent's behavior.

This ancient game is played between two participants who simultaneously cast one of three figures by their fingers - Rock, Paper or Scissors.

If both cast the same figure, the round is considered a draw. Otherwise the following rules are applied:

Rock beats Scissors, Scissors beat Paper, Paper beats Rock

Write a program for this game to be played against AI.

13. Mastermind

This is an old game for two players, often played with paper and pen.

First player, let it be Alice - chooses a secret 4-digit code (like 1492), with all digits different.

The second player, let it be Barbara - makes several attempts to guess this code. She can offer any combinations of 4 digits (without repetitions) - and for each attempt the Alice should answer with a hint.

The hint consists of two values:

For example, if the secret value is 1492 and Barbara's guess is 2013 - Alice should answer with 0-2.
And if the guess is 1865, then the hint would be 1-0.

Problem statement: Your goal is to write a program which calculates the values which should be told as a hint to the given guess.

Input data will contain the secret value and the number of guesses in the first line.
Second line will contain the specified amount of guesses.
Answer should contain hints for these guesses, they should be given in format X-Y and separated with spaces.

For Example:
input data:
1492 5
2013 1865 1234 4321 7491
answer: 0-2 1-0 1-2 0-3 2-1

14. Yatzee or Dice Poker

Dice game of Yatzee is played with 5 standard dice (having from 1 to 6 points on their sides). The player's goal is to gather some a combination of points. Suppose, the following combinations:

(combinates named with two words are written with dash here for consistency with answers which our code will produce)

Write a program which for given combination of dice will determine its type.

Input data contains a number of test-cases in the first line.
Next lines contain 5 values each - points of player's dice.
Answer should contain the name for each of the combinations. Names could be pair, two-pairs, three, four, yatzee, full-house, small-straight, big-straight or none, separated with spaces.

Example:

input data:  
3
3 6 5 6 1
1 6 6 1 6
2 4 3 5 1
answer: pair full-house small-straight