teachinTech


U-Code: Input and More Calculations

This activity provides some practice and experience getting user input, doing calculations, and show information on the screen.

Turn In: At least four of the following files

Create the filename listed below and complete the task(s) that is indicated. Be sure to run your program and make sure that it runs with no errors and produces the correct results. Submit the completed files to your instructor.

The top of each file should have a comment section that includes the name of the file, your name, the date your program was completed, and a brief description of what it does.

1. LearnName.py -- to remember the name of someone you first meet, studies show it is best to repeat their name several times. This program will ask the person to type in their salutation (i.e. Dr, Mr, Ms, Mrs), first name, and last name. Then the program will display a message using the information provided. Assuming that the person using your program puts in the salutation of Ms, first name of Kim, and last name of James, then the message would look like ...

     It is my pleasure to meet you Ms Kim James.  I have heard a lot of good things about you Ms James.  Thank you for taking the time to talk today Kim.

2. RectPerimArea.py -- this program will ask for the length of the rectangle and the width of the rectangle. Those values will then be used to calculate and display both the perimeter and the area of the rectangle. The perimeter is the distance around the rectangle (add all four sides together) and area is found by taking the length times the width. Here is a sample of what your program will look like. Be sure to test your program with other numbers as well and check the results.

     What is the length of the rectangle: 5
     What is the width  of the rectangle: 3

The rectangle perimeter is ... 16 The rectangle area is ... 15

3. Yards2FeetInches.py -- this program will convert yards to feet then yards to inches. The program should start by asking for the number of yards then display both the converted number of feet and the number of inches. There are 3 feet in each yard and there are 12 inches in each foot. Below is a sample of what your program may look like. Be sure to test your program with several different values for yards.

     Please enter the number of yards to convert: 5

There are 15 feet in 5 yards and there are 180 inches in 5 yards.

4. MyMadLib.py -- a mad lib is a word game where specific types words are asked for then those words are placed into a saying. For this program you will ask for the following four items ...

     1. A noun -- person, place, or thing
     2. A verb -- action
     3. An adjective -- describes a noun
     4. An adverb -- describes how to do an action

Place those words into the following phrase where indicated ...

     I opened my door and saw a [[adjective]] [[noun]].  So I [[verb]] to the curb to get a better look.  The next day around the same time, I went outside [[adverb]] and again saw the [[noun]].

5. PayCalc.py -- your program should ask the person using it how much they make per hour then ask them how many hours they worked for the week. The program will then display how much they earned for that week. Here is how your program might look (be sure to try some different values and check the results) ...

     How many hours did you work this week? 35
     How much do you make per hour of work? 8.75

At $8.75 for 35 hours, you have earned $306.25 this week.

6. ConeVolume.py -- this program will ask the person using it for both the radius and the height of the cone. The volume of a cone is one-third times pi times radius squared times height. Display the information similar to the following ...

     Cone radius: 3
	 Cone height: 4

Volume of cone with height 4 and radius 3 is 37.68


Copyright © 2021 Eric Schumm. Permission granted to freely use this in your classroom.