Question: The programs you will write for this project are copied with permission, or adapted from, the exercises in A Beginner s Python Tutorial. Each program

The programs you will write for this project are copied with permission, or adapted from, the exercises in A Beginners Python Tutorial.
Each program should be written, tested, and debugged. The first two programs should also be fully commented, with each line documented by a descriptive comment. The remaining programs should have a single comment line at the beginning to describe the function of the program. All programs should start with a display of your name, student id#, and the program number and name. When storing the files, name them as prog1.py, prog2.py, etc.
Example of Author/Program Information Output
Program author: B. Rubble
ID#: 1234567
Program 1Math Functions
Program 1Math Functions
Write an algorithm for a program that shows the use of all six math functions. Write, test, and debug the program using Python.
SAMPLE OUTPUT (not including author/program information)
ADDITION: 2+2=4
SUBTRACTION: 4-2=2
MULTIPLICATION: 4*2=8
DIVISION: 4/2=2
EXPONENT: 2**3=8
REMAINDER: 5%2=1
Program 2Using Input
Write an algorithm for a program that receives, as input from the user, 2 string variables and 2 integer variables; then joins together and displays the combined strings; and finally multiplies the two numbers on a new line. Write, test, and debug the program using Python.
SAMPLE OUTPUT (not including author/program information)
Input string 1? Billy
Input String 2? Bob
Input integer A?23
Input integer B?2
BillyBob
46
Program 3Loops and If Conditions
Write a program that requests a password after the author/program information is displayed. Make the password "hello". The program should then ask the user for their name: if the name entered is the same as your name, the program should respond with "What a great name!"; if they enter "Madonna" or "Cher", the program should respond "May I have your autograph, please?". For any other input, the program should respond with "(input name), thats a nice name".
SAMPLE OUTPUT (including author/program information)
Program author: Barney Rubble
ID#: 1234567
Program 3LOOPS AND IF CONDITIONS
Password? unicorn
Password? opus
Password? hello
Welcome to the second half of the program!
What is your name? Barney
What a great name!
ALTERNATE OUTPUTS
What is your name? Cher
May I have your autograph, please?
What is your name? Bill
Bill, thats a nice name.
Program 4Functions
Rewrite the area.py program (shown below, or in the Creating Functions section of the tutorial) so that it has separate functions for the perimeter and area of a square, a rectangle, and a circle (3.14* radius**2). This program should include a menu interface that has exit the program as one of its choices.
SAMPLE PROGRAM EXECUTION
Area.py
#This program calculates the perimeter and area of a rectangle
print "Calculate information about a rectangle"
length = input("Length:")
width = input("Width:")
print "Area",length*width
print "Perimeter",2*length+2*width
SAMPLE OUTPUT (not including author/program information)
CALCULATIONS MENU
1) AREA (SQUARE)
2) AREA (RECTANGLE)
3) AREA (CIRCLE)
4) PERIMETER (SQUARE)
5) PERIMETER (RECTANGLE)
6) PERIMETER (CIRCLE)
7) EXIT
INPUT MENU CHOICE (1,2,3,4,5,6 OR 7)?2
YOU HAVE CHOSEN AREA (RECTANGLE)
INPUT WIDTH? 8
INPUT LENGTH? 4
AREA IS 32
INPUT MENU CHOICE?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!