Question: In Python. You have started your own company (congratulations!) that sells cute dog pictures. The file available named sales.json holds the sales of each day
In Python.
You have started your own company (congratulations!) that sells cute dog pictures. The file available named "sales.json" holds the sales of each day of the past year. Use the load function of the json module and the open built-in function to access the data in this file and print the average sales for the entire year (using the Sum and Count pattern).
sum pattern
sum = 0
for item in a_list
sum = sum + item
count pattern
count = 0
for item in a_list
count = count + 1
sales.json
[911.15, 1136.34, 872.03, 894.44, 1099.52, 1065.87, 1033.29, 1224.24, 883.07, 1260.14, 1011.57, 910.28, 941.62, 844.24, 1161.68, 919.9, 814.59, 1064.5, 913.12, 1137.3, 962.34, 979.25, 907.83, 990.99, 1110.69, 1010.35, 876.52, 1129.49, 834.49, 1115.12, 1101.72, 1102.5, 909.42, 1166.48, 1011.2, 1138.01, 1175.25, 950.86, 1132.81, 786.67, 866.86, 1119.29, 950.24, 956.61, 1132.45, 876.86, 979.24, 936.77, 972.52, 1155.65, 918.41, 994.6, 857.96, 1164.99, 1094.37, 1043.25, 1112.53, 1133.7, 1220.73, 1072.77, 1034.75, 1133.28, 1021.64, 1057.54, 865.47, 996.03, 1214.58, 922.35, 912.92, 985.26, 1255.89, 1035.66, 949.23, 954.49, 943.99, 1254.5, 1071.76, 1095.84, 1021.62, 1047.05, 694.42, 1014.13, 1012.63, 987.71, 1091.1, 1060.01, 909.82, 1203.05, 981.47, 849.15, 1060.41, 947.91, 1044.57, 1137.45, 986.85, 972.31, 933.94, 1135.71, 998.93, 1047.57, 993.17, 861.09, 954.42, 976.09, 1060.28, 1157.98, 1067.41, 1305.02, 1282.33, 1128.2, 1227.94, 1292.34, 1176.82, 985.38, 957.24, 995.26, 823.24, 982.35, 893.56, 1051.88, 1054.83, 1309.99, 966.28, 986.56, 891.29, 1129.03, 1062.96, 1152.34, 875.12, 1124.56, 1155.2, 1155.36, 1122.62, 1075.9, 1123.01, 1208.98, 987.1, 1064.69, 1016.01, 1079.51, 1241.18, 1012.84, 1015.95, 1103.88, 991.63, 916.74, 1144.64, 1155.62, 1030.55, 1097.42, 1153.02, 1102.44, 1176.89, 1130.34, 979.62, 1074.35, 1045.72, 1065.48, 1026.57, 1138.26, 1018.55, 1168.18, 964.64, 935.16, 1023.37, 1118.44, 1034.02, 1048.81, 905.15, 1024.07, 1007.56, 939.96, 843.4, 1123.7, 1130.96, 1020.35, 938.21, 1102.38, 1014.67, 1167.83, 985.28, 1010.65, 1065.0, 1057.32, 1174.08, 1167.57, 1183.51, 963.77, 1111.02, 1156.93, 1247.87, 995.34, 1180.28, 1052.77, 1140.56, 1155.49, 1263.62, 1255.16, 1121.0, 1083.64, 946.39, 1031.37, 1130.64, 1180.0, 1231.12, 1201.75, 932.79, 1273.39, 1060.91, 930.35, 1227.58, 1150.08, 1141.26, 1152.91, 1167.51, 1123.36, 1344.73, 1253.99, 1013.93, 1206.09, 1003.38, 1083.16, 1059.09, 1199.37, 1185.96, 1274.17, 1299.3, 1135.35, 1070.3, 1182.83, 1306.7, 992.2, 1129.73, 795.36, 1004.5, 1187.24, 1244.41, 1013.16, 1146.26, 1161.29, 1195.38, 1017.68, 1166.3, 1264.26, 1228.04, 1074.16, 1095.37, 1038.6, 1257.41, 1120.74, 1021.0, 1173.81, 1219.85, 1172.47, 1290.09, 1074.48, 1217.23, 1075.44, 895.97, 962.46, 1192.65, 1070.15, 1183.04, 1105.65, 1099.08, 1106.82, 1127.86, 1215.6, 1127.33, 1166.0, 1377.46, 1160.5, 1063.91, 1075.07, 1100.73, 1138.3, 1131.67, 1151.85, 1067.95, 1066.01, 1054.63, 985.28, 1033.34, 1085.31, 1320.32, 1165.31, 1278.56, 962.53, 1178.73, 979.09, 1036.28, 1243.85, 1207.88, 1081.51, 1034.08, 1036.91, 1248.44, 1191.8, 1075.45, 1190.44, 1078.16, 1067.67, 1159.71, 1002.37, 1207.05, 1150.97, 1146.62, 1131.24, 1150.22, 1023.72, 1163.27, 1183.26, 1129.01, 1295.35, 992.8, 1026.04, 1138.15, 1193.21, 1163.61, 1329.73, 1250.16, 1143.47, 1172.16, 1061.67, 1053.88, 1371.74, 1274.31, 1163.63, 1211.39, 1122.26, 1124.38, 1053.38, 1019.32, 1336.04, 1116.46, 1150.27, 1324.75, 1192.63, 1309.1, 1150.31, 1281.37, 1207.23, 1086.88, 1132.32, 1221.73, 1161.69, 900.14, 1119.06, 1265.14, 1090.41, 1006.88, 1205.77, 1320.42, 1125.44, 1291.51, 1069.33, 1024.78, 962.39, 1114.9, 1141.25, 1100.02, 1080.33, 1002.9, 1265.88, 1186.42]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
