RunсMarkdownWrite a Python program that takes a dictionary as an input from the user and then prints the average of all the values in the dictionary.[You are not allowed to use len() and...


Downloads/<br>E ID-21201491;NAME-Nuzhat Taba x<br>+<br>English<br>O localhost:8888/notebooks/Downloads/ID-21201491%3BNAME-Nuzhat%20Tabassum%20%3Bsec-17%20%3B%20CSE110.ipynb<br>Cjupyter ID-21201491;NAME-Nuzhat Tabassum ;sec-17 ; CSE110 Last Checkpoint: 6 minutes ago (autosaved)<br>Logout<br>File<br>Edit<br>View<br>Insert<br>Cell<br>Kernel<br>Widgets<br>Help<br>Trusted<br>Python 3 O<br>+<br>> Run<br>с<br>Markdown<br>Write a Python program that takes a dictionary as an input from the user and then prints the average of all the values in the dictionary.<br>[You are not allowed to use len() and sum()]<br>Hint (1): For taking dictionary input<br>Approach(1): For taking dictionary as an input from the user, you may take the whole dictionary as a string using the input() function. Then you can use the<br>split(), strip() functions and conditions to get the keys and values from the string. Finally, you can make the dictionary using the obtained data.<br>Approach(2): If the first approach seems too difficult you can create an empty dictionary and then just run a simple loop. For each iteration ask the user for a<br>key and a value using the input() function and keep updating the dictionary with the key and value.<br>Hint (2): After you have a dictionary, you can use dictionary functions to get all the values from it, run loop to calculate the sum and the total number of values<br>in the dictionary in order to find out the average.<br>Sample Input 1:<br>{'Jon': 100, 'Dan':200, 'Rob':300}<br>Sample Output 1:<br>Average is 200.<br>Sample Input 2:<br>{'Jon': 100, 'Dan':200, 'Rob':30, 'Ned':110}<br>Sample Output 2:<br>Average is 110.<br>11:18 PM<br>11/29/2021<br>

Extracted text: Downloads/ E ID-21201491;NAME-Nuzhat Taba x + English O localhost:8888/notebooks/Downloads/ID-21201491%3BNAME-Nuzhat%20Tabassum%20%3Bsec-17%20%3B%20CSE110.ipynb Cjupyter ID-21201491;NAME-Nuzhat Tabassum ;sec-17 ; CSE110 Last Checkpoint: 6 minutes ago (autosaved) Logout File Edit View Insert Cell Kernel Widgets Help Trusted Python 3 O + > Run с Markdown Write a Python program that takes a dictionary as an input from the user and then prints the average of all the values in the dictionary. [You are not allowed to use len() and sum()] Hint (1): For taking dictionary input Approach(1): For taking dictionary as an input from the user, you may take the whole dictionary as a string using the input() function. Then you can use the split(), strip() functions and conditions to get the keys and values from the string. Finally, you can make the dictionary using the obtained data. Approach(2): If the first approach seems too difficult you can create an empty dictionary and then just run a simple loop. For each iteration ask the user for a key and a value using the input() function and keep updating the dictionary with the key and value. Hint (2): After you have a dictionary, you can use dictionary functions to get all the values from it, run loop to calculate the sum and the total number of values in the dictionary in order to find out the average. Sample Input 1: {'Jon': 100, 'Dan':200, 'Rob':300} Sample Output 1: Average is 200. Sample Input 2: {'Jon': 100, 'Dan':200, 'Rob':30, 'Ned':110} Sample Output 2: Average is 110. 11:18 PM 11/29/2021
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here