Though CPUs, and computer hardware in-general, are not the main focus of this course, it can be useful to know a thing or two about computer hardware. The CPU (Central Processing Unit) is generally the piece of hardware that carries out the instructions of the python programs that you run in this class.
In this short PA, you will write a program that takes a few input values related to CPU performance.
The program should determine whether or not the specified CPU is within one of four categories: high-performance, medium-performance, low-performance, and in need of an upgrade.
Name the file cpu.py
.
Shown below is an example of the program prompting the user for two inputs, and then printing out the corresponding CPU performance category:
Press ENTER or type command to continue
Enter CPU gigahertz:
2.7
Enter CPU core count:
2
That is a low-performance CPU
The program should spit out one of 4 strings:
That is a high-performance CPU.
That is a medium-performance CPU.
That is a low-performance CPU.
That CPU could use an upgrade.
How you determine which to print out should be based on the below table:
performance level | min GHz | min cores |
high-performance | 3.2 | 8 |
medium-performance | 2.5 | 6 |
low-performance | 2.0 | 2 |
There’s also one “special-case” rule: If a CPU has 20 or more cores, regardless of the other stats, it should be considered high-performance.
Below are several examples of program runs. There will be more tests on Gradescope.
Enter CPU gigahertz:
2.0
Enter CPU core count:
8
That is a low-performance CPU.
Enter CPU gigahertz:
4.0
Enter CPU core count:
7
That is a medium-performance CPU.
You must use some combination of is, elif, and/or else statements to get this PA working. Though you are not required to, you might want to nest if-statements to help reduce complexity of the if-statement conditions. Also, keep in mind that you are expected to follow the rules of the code style guide if you want to get full points for the assignment.
This PA is due on Saturday, Feb 1st at 7:00pm. Turn in the program via Gradescope. You should try to make sure that all of the test cases pass before you turn it in. You can still submit without all of the cases passing, but that is not preferable.