Python programming help for number 4 and 5, please. Given a dictionary: gradeCou
ID: 3737678 • Letter: P
Question
Python programming help for number 4 and 5, please.Given a dictionary: gradeCounts-("A": 8, "B": 3, "C": 15, "F": 2, "H": 6 } write the Python statement(s) to print: 4. a. All the keys. b. All the values. c. All the key and value pairs. d. The average value. e. A chart similar to the following in which each row contains a key followed by a number of asterisks equal to the key's data value as shown below. B: C: F: t4 5. Given three sets, setl, set2, and set3, write Python statement(s) to perform the following actions: Create a new set of all elements that are in setl or set2 but not both. Create a new set of all elements that are in only one of the three sets setl, set2, and set3. Create a new set of all integer elements in the range 1 through 25 that are not in setl. a. b. c.
Explanation / Answer
Solution:
The first four subparts have been answered as per Chegg guidelines, please repost others.
a)
code:
Output:
C:UsersPhoenixAppDataLocalProgramsPythonPython36-32python.exe C:/Users/Phoenix/PycharmProjects/try/keyValue.py
dict_keys(['A', 'B', 'C', 'F', 'H'])
Process finished with exit code 0
b)
code:
Output:
C:UsersPhoenixAppDataLocalProgramsPythonPython36-32python.exe C:/Users/Phoenix/PycharmProjects/try/keyValue.py
dict_values([8, 3, 15, 2, 6])
Process finished with exit code 0
c)
code:
Output:
C:UsersPhoenixAppDataLocalProgramsPythonPython36-32python.exe C:/Users/Phoenix/PycharmProjects/try/keyValue.py
All key and value pairs: {'A': 8, 'B': 3, 'C': 15, 'F': 2, 'H': 6}
Process finished with exit code 0
d)
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.