Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python Programming Start out with PYTON third edition by Goddis Chapter five: Fu

ID: 674495 • Letter: P

Question

Python Programming

Start out with PYTON third edition by Goddis

Chapter five: Functions

8. Paint Job Estimator

A painting company has determined that for every 112 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $35.00 per hour for labor. Write a program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program should display the following data:

• The number of gallons of paint required
• The hours of labor required
• The cost of the paint
• The labor charges
• The total cost of the paint job.

Program 4: Blackjack

Part of the card game Blackjack involves dealing two cards from a shuffled deck of cards; to each of the players. (There’s more to it than that, but we’ll start with this).

Create a function that returns a string representing a randomly chosen card, for example, “6 of Clubs” or “King of Hearts”.

Your program should ask how many players there are. Then, it should use the function to “deal” two random cards to each player. Print the cards each player gets on the screen.

Extra question there’s more work to do before this program will play a game with you. Think about what you would need to do to turn this into a program that can play Blackjack.

Program 5: Caesar Cipher

This problem builds on the Caesar Cipher program from a previous lab.

If you didn’t get to that part of the lab, here’s some code that starts with a word, “Minneapolis” and shifts each letter by 6 letters to produce a coded word.

word = "Minneapolis"

shift = 6

coded_word = ""

for letter in word:

    coded_letter = chr(ord(letter) + shift)

    coded_word = coded_word + coded_letter

print(word + " in code is " + coded_word)

Please write a function that takes a string (a word) and a number (the number of letters to shift) as arguments. The function should shift each letter by the number given; and return the coded word.

Or, your function can take a sentence and a number as an argument, and return a coded sentence.

Now, can you write a decoding function? This function will take a coded string and a number as arguments.

Extra question: write an encrypting/decrypting program. Ask the user if they want to encrypt or decrypt, and call the appropriate function. What if the user has lots of strings to encrypt and decrypt? Perhaps you could use a while true loop so the program repeats until the user wants to quit?

Explanation / Answer

8) CODE :

4) CODE :

5) CODE :