Skip to content

Commit

Permalink
Update bubblesort.py
Browse files Browse the repository at this point in the history
  • Loading branch information
skakarl2 authored Oct 30, 2024
1 parent 92d7463 commit 5de84b1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bubblesort.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,28 @@ def bubble_sort(arr):
arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = bubble_sort(arr)
print("Sorted array:", sorted_arr)


import csv
from collections import defaultdict

def read_csv(file_path):
data = []
with open(file_path, mode='r') as file:
csv_reader = csv.DictReader(file)
for row in csv_reader:
data.append(row)
return data

def calculate_statistics(data):
stats = defaultdict(lambda: {'count': 0, 'total': 0})
for row in data:
for key, value in row.items():
try:
value = float(value)
stats[key]['count'] += 1
stats[key]['total'] += value
except ValueError:
continue
return stats

0 comments on commit 5de84b1

Please sign in to comment.