def learn_to_program(): return """ CS149 - Introduction to Programming Department of Computer Science James Madison University Spring 2022 """
The American Sweater Company of Iona, Idaho (ASCII) makes monogrammed sweaters. The management would like an easier way to determine a monogram from a customer’s name. They have asked you to write a program, named monogram.py
, that will do the work for them.
The program should accept the customer’s first, middle and last names, and output the corresponding monogram.
The input and output should look like this, for example:
To get credit for this exercise, your solution should use a single print statement.
Be careful! There is a blank line between the input and the output.
The JMU basketball program needs help calculating player statistics. They would like you to write them a program, named scores.py
, that:
score_list
. Each
entry in this list represents the total points scored by a
particular player in a single game. These numbers can be whatever
you want for the purposes of testing your program.For instance, if the player had scores of 10, 0, 5, 5, and 15, the program would print:
Gradescope will change the contents of your list and observe your program’s output. The output should be correct for any list of integers of length at least 1. You should test your program with several different integer lists to make sure that it behaves correctly in each case.
Note: You must not use loops in your program. Programs that use loops will receive no credit.
The JMU basketball program needs some more help. They’d like you to create a program for displaying the statistics of players on request.
You will create a program, named scoring.py
, that will display the points scored by a player on request. Your program will allow the user to type in the last name of a player, and will then display the points scored over a season by that player.
For your program, you will use the stats from the 2020-2021 Women’s Basketball Team:
Name | Points Scored |
---|---|
Jefferson | 388 |
Hazell | 237 |
Tucker | 216 |
McDaniel | 195 |
Green | 140 |
Your program will store this data in a dictionary named stats
, and use this dictionary to retrieve the values for output.
Your program should replicate the following output and input:
Note: Your solution must use a dictionary. Solutions using if
statements or loops will receive no credit.
Your CS professor needs help calculating scores for his class The History of Keyboards. Students are graded on four exams throughout the semester, with the lowest score dropped from the average. You have taken a side job to write a program, named grades.py
, to calculate the scores.
The program should replicate the following output and input:
You may assume that the scores entered by the user will be integers. In solving this problem, you should put the four grades in a list named scores
and use list functions and methods to find the lowest score and the final score. When your program finishes, scores
should hold the three highest scores. Note that lists do not have a method for finding an average.
Note: You must not use loops in your program. Programs that use loops will receive no credit.
A Bar Chart is used to display data that comes in categories, like this one:
from https://www.statista.com/chart/21017/most-popular-programming-languages/
Reproduce the first five rows of the chart above in text like this:
Start your program, named bar_chart.py
, like this:
Gradescope will test your code by changing the labels and data and seeing if the chart still prints out neatly and correctly.
Notes
float
to int
.)Tip: You can format long_string
to fit into a smaller space by using f'{long_string:.4s}'
which truncates the string to 4 characters. You can also add extra spaces to short_string
by using f'{short_string:25s}'
, which adds enough spaces to make the whole string at least 25 characters long. You can even put them together, like f'{long_string:10.5s}
. Try it in Thonny! You’ll need this formatting to finish this problem correctly.
Note: You must not use loops in your program. Programs that use loops will receive no credit.