Delve into the Python dictionary data structure. Learn how to store and manage key-value pairs, perform efficient data retrieval, and leverage essential dictionary methods for enhanced Python programming experiences.


import csv
amountdisct ={}
with open("/Users/npblue/PycharmProjects/data/credit.csv", 'r') as file:
  csvreader = csv.reader(file, delimiter=',')
  count=0
  for row in csvreader:
      if count==0:
          count += 1
      else:
          amountdisct[row[0]]=float(row[7])

print(amountdisct)
def getMedian(lst):
    sorted_lst = sorted(lst)
    n = len(sorted_lst)
    if n % 2 == 0:
        middle1 = sorted_lst[n // 2 - 1]
        middle2 = sorted_lst[n // 2]
        median = (middle1 + middle2) / 2
    else:
        median = sorted_lst[n // 2]
    return median

print("Type  :",type(amountdisct))

print("min value :",min(amountdisct.values()))

print("max value :",max(amountdisct.values()))

print("mean value :",sum(amountdisct.values())//len(amountdisct.values()))

print("median value :",getMedian(amountdisct.values()))