I can't figure out where I made a mistake on this pyhton code because when I run the program the following comes up: main() TypeError: main() missing 9 required positional arguments: 'self', 'month', 'day', 'store', 'location', 'item', 'brand', 'store_type', and 'sale' import csv filename = "sales.csv" with open(filename) as salesData: csvReader = csv.reader(salesData) for row in csvReader: print(row) class Sales: def __init__(self, month, day, store, location, item, brand, store_type, sale): self.month = month self.day = day self.market = store self.type = store_type self.location = location self.item = item self.brand = brand self.sale = sale class Month: def __init__(self, months, day): self.name = months self.day = day def get_month(self): return self.name def get_days(self): return self.day class Brand: def __init__(self, market, store_type, location): self.market = market self.type = store_type self.location = location def get_market(self): return self.market def get_type(self): return self.type def get_location(self): return self.location class Place: def __init__(self, market, store_type, location): self.market = market self.type = store_type self.location = location def get_market(self): return self.market def get_type(self): return self.type def get_location(self): return self.location class Category: def __init__(self, product_type, product_def): self.product_type = product_type self.product_def = product_def def get_product_type(self): return self.product_type def get_product_def(self): return self.product_def def market_share(self, month, day, store, location, item, brand, store_type, sale): sales: Sales = Sales(self, month, day, store, location, item, brand, store_type, sale) for i in sales: total = 0 for j in sale: a1 = month a2 = month b1 = day b2 = day c1 = location c2 = location d1 = item d2 = item e1 = store e2 = store f1 = store_type f2 = store_type g1 = brand g2 = brand h1 = sale h2 = sale if a1 == a2 and b1 == b2 and c1 == c2 and d1 == d2 and e1 == e2 and f1 == f2 and g1 == g2 and h1 == h2: total += sale def main(self, month, day, store, location, item, brand, store_type, sale): sales = list() print(sales) market_share(self, month, day, store, location, item, brand, store_type, sale) for line in sales: print("For the month of", line[0], ',', line[6], line[3], line[4], line[5], "store has sales of $", line[7], "in the ", line[2], "market for a market share of", sales) main()
I can't figure out where I made a mistake on this pyhton code because when I run the program the following comes up:
main()
TypeError: main() missing 9 required positional arguments: 'self', 'month', 'day', 'store', 'location', 'item', 'brand', 'store_type', and 'sale'
import csv
filename = "sales.csv"
with open(filename) as salesData:
csvReader = csv.reader(salesData)
for row in csvReader:
print(row)
class Sales:
def __init__(self, month, day, store, location, item, brand, store_type, sale):
self.month = month
self.day = day
self.market = store
self.type = store_type
self.location = location
self.item = item
self.brand = brand
self.sale = sale
class Month:
def __init__(self, months, day):
self.name = months
self.day = day
def get_month(self):
return self.name
def get_days(self):
return self.day
class Brand:
def __init__(self, market, store_type, location):
self.market = market
self.type = store_type
self.location = location
def get_market(self):
return self.market
def get_type(self):
return self.type
def get_location(self):
return self.location
class Place:
def __init__(self, market, store_type, location):
self.market = market
self.type = store_type
self.location = location
def get_market(self):
return self.market
def get_type(self):
return self.type
def get_location(self):
return self.location
class Category:
def __init__(self, product_type, product_def):
self.product_type = product_type
self.product_def = product_def
def get_product_type(self):
return self.product_type
def get_product_def(self):
return self.product_def
def market_share(self, month, day, store, location, item, brand, store_type, sale):
sales: Sales = Sales(self, month, day, store, location, item, brand, store_type, sale)
for i in sales:
total = 0
for j in sale:
a1 = month
a2 = month
b1 = day
b2 = day
c1 = location
c2 = location
d1 = item
d2 = item
e1 = store
e2 = store
f1 = store_type
f2 = store_type
g1 = brand
g2 = brand
h1 = sale
h2 = sale
if a1 == a2 and b1 == b2 and c1 == c2 and d1 == d2 and e1 == e2 and f1 == f2 and g1 == g2 and h1 == h2:
total += sale
def main(self, month, day, store, location, item, brand, store_type, sale):
sales = list()
print(sales)
market_share(self, month, day, store, location, item, brand, store_type, sale)
for line in sales:
print("For the month of", line[0], ',', line[6], line[3], line[4], line[5], "store has sales of $", line[7],
"in the ", line[2], "market for a market share of", sales)
main()
Trending now
This is a popular solution!
Step by step
Solved in 2 steps