06 Team Activity: Troubleshooting Functions
Instructions
Work as a team as explained in the instructions for the lesson 2 team activity.
Purpose
Write a program with several functions. Use a debugger while writing your program or after writing it to step through your code.
Problem Statement
The Rosenberg self-esteem scale is a self-esteem measure developed by the sociologist Morris Rosenberg in 1965. It is still used in social-science research today. To complete the measure, a person completes a survey that contains the following ten statements.
- I feel that I am a person of worth, at least on an equal plane with others.
- I feel that I have a number of good qualities.
- All in all, I am inclined to feel that I am a failure.
- I am able to do things as well as most other people.
- I feel I do not have much to be proud of.
- I take a positive attitude toward myself.
- On the whole, I am satisfied with myself.
- I wish I could have more respect for myself.
- I certainly feel useless at times.
- At times I think I am no good at all.
The person responds to each statement by choosing one of these four options: strongly disagree, disagree, agree, or strongly agree. The person’s response to each statement is worth 0–3 points, meaning the highest possible score is 10 * 3 = 30 points. If a person scores lower than 15 points, the person may have a problematic low self-esteem.
Notice that five of the statements (numbers 1, 2, 4, 6, 7) are positive and are scored like this:
Choice | Points |
---|---|
Strongly Disagree | 0 |
Disagree | 1 |
Agree | 2 |
Strongly Agree | 3 |
The other five statements (numbers 3, 5, 8, 9, 10) are negative and are scored like this:
Choice | Points |
---|---|
Strongly Disagree | 3 |
Disagree | 2 |
Agree | 1 |
Strongly Agree | 0 |
Assignment
As a team, write a Python program named esteem.py
that implements the Rosenberg self-esteem scale. Your program must
ask the user to respond to each of the ten statements with D, d, a,
or A which mean strongly disagree, disagree, agree, and strongly
agree. Your program must compute the score for each answer and sum
and display the person’s total score. You should think about how you
will separate this program into functions before you begin writing
the program.
Core Requirements
- Your program prints the introductory text as shown in the Testing Procedure section below.
- Your program prints each of the ten statements and gets a response from the user.
- Your program computes the score for each response and sums all the scores and displays the total score.
Stretch Challenges
If your team finishes the core requirements in less than an hour, complete one or more of these stretch challenges. Note that the stretch challenges are optional.
- Write a program that implements the Nature Relatedness Scale
Helpful Documentation
- This video about the Python Debugger (17 minutes) from the preparation content for this lesson shows how to use the debugger in VS Code fo find mistakes in a program.
Testing Procedure
Verify that your program works correctly by following each step in this testing procedure:
- Use the debugger in VS Code to step through your program and verify that it works correctly.
- Run your
esteem.py
program and enter the inputs shown below. Ensure that your program’s output matches the output below.> python esteem.py This program is an implementation of the Rosenberg Self-Esteem Scale. This program will show you ten statements that you could possibly apply to yourself. Please rate how much you agree with each of the statements by responding with one of these four letters: D means you strongly disagree with the statement. d means you disagree with the statement. a means you agree with the statement. A means you strongly agree with the statement. 1. I feel that I am a person of worth, at least on an equal plane with others. Enter D, d, a, or A: A 2. I feel that I have a number of good qualities. Enter D, d, a, or A: A 3. All in all, I am inclined to feel that I am a failure. Enter D, d, a, or A: D 4. I am able to do things as well as most other people. Enter D, d, a, or A: a 5. I feel I do not have much to be proud of. Enter D, d, a, or A: d 6. I take a positive attitude toward myself. Enter D, d, a, or A: a 7. On the whole, I am satisfied with myself. Enter D, d, a, or A: a 8. I wish I could have more respect for myself. Enter D, d, a, or A: a 9. I certainly feel useless at times. Enter D, d, a, or A: a 10. At times I think I am no good at all. Enter D, d, a, or A: d Your score is 21. A score below 15 may indicate problematic low self-esteem.
Sample Solution
Please work diligently with your team for the one hour meeting. After the meeting is over, please compare your solution to the sample solution and the stretch solution. Please do not look at the sample solutions until you have either finished the program or diligently worked for at least one hour. At the end of the hour, if you are still struggling to complete the assignment, you may use the sample solution to help you finish.
Ponder
Did you use the debugger to step through your program? What is the difference between the "Step Over" () and "Step Into" () buttons?
Submission
When you have finished the activity, please report your progress via the associated I‑Learn quiz. When asked about which of the requirements you completed, feel free to include any work done during the team meeting or after the meeting, including work done with the help of the sample solution, if necessary. In short, report on what you were able to accomplish, regardless of when you completed it or if you needed help from the sample solution.