from flat import Bill, Flatmate from reports import PdfReport amount = float(input("Please enter the bill amount: ")) period = input("Please enter the billing period, e.g. 'December 2021': ") flatmate1_name = input("Please enter the first flatmate's name: ") flatmate1_days = int( input(f"How many days will {flatmate1_name} be billed for? ")) flatmate2_name = input("Please enter the second flatmate's name: ") flatmate2_days = int( input(f"How many days will {flatmate2_name} be billed for? ")) the_bill = Bill(amount=amount, period=period) flatmate1 = Flatmate(name=flatmate1_name, days_in_house=flatmate1_days) flatmate2 = Flatmate(name=flatmate2_name, days_in_house=flatmate2_days) print(f"{flatmate1.name} pays: ", flatmate1.pays(bill=the_bill, flatmate2=flatmate2)) print(f"{flatmate2.name} pays: ", flatmate2.pays(bill=the_bill, flatmate2=flatmate1)) pdf_report = PdfReport(filename=f"{the_bill.period}.pdf") pdf_report.generate(flatmate1=flatmate1, flatmate2=flatmate2, bill=the_bill)
from flat import Bill, Flatmate from reports import PDFReport amount = float(input("Hi user, enter the bill amount: £")) period = input("What is the bill period (e.g. Dec 2020): ") name1 = input("What is your name? ") days_in_house1 = int( input( f"How many days did {name1} stay in the house during the bill period? " )) name2 = input("What is the other flatmate's name? ") days_in_house2 = int( input( f"How many days did {name2} stay in the house during the bill period? " )) bill = Bill(amount, period) f1 = Flatmate(name1, days_in_house1) f2 = Flatmate(name2, days_in_house2) pdf_report = PDFReport(f"{bill.month}.pdf") pdf_report.generate(f1, f2, bill)
from reports import PdfReport from flat import Bill, Flatmate amount = float(input("Hey user enter the bill amount: ")) period = input("What is the bill period? E.g. December 2020: ") name1 = input("What is your name? ") days_in_house1 = int(input(f"How many days did {name1} stay in the house during the bill period? ")) name2 = input("What is the name of other flatmate? ") days_in_house2 = int(input(f"How many days did {name2} stay in the house during the bill period? ")) the_bill = Bill(amount, period) flatmate1 = Flatmate(name1, days_in_house1) flatmate2 = Flatmate(name2, days_in_house2) print(f"{flatmate1.name} pays=", flatmate1.pays(the_bill, flatmate2)) print(f"{flatmate2.name} pays=", flatmate2.pays(the_bill, flatmate1)) pdf_report = PdfReport(filename=f"{the_bill.period}.pdf") pdf_report.generate(flatmate1, flatmate2, the_bill)
from flat import Bill, Flatmate from reports import PDFReport, FileSharer amount = float(input("Hey user, enter the bill amount: ")) period = input("What is the bill period? E.g. December 2020: ") name1 = input("What is your name? ") days_in_house1 = int( input( f"How many days did {name1} stay in the house during the bill period? " )) name2 = input("What is your name of the other flatmate? ") days_in_house2 = int( input( f"How many days did {name2} stay in the house during the bill period? " )) the_bill = Bill(amount, period) flatmate1 = Flatmate(name1, days_in_house1) flatmate2 = Flatmate(name2, days_in_house2) print(f"{name1} pays: ", flatmate1.pays(the_bill, flatmate2)) print(f"{name2} pays: ", flatmate2.pays(the_bill, flatmate1)) pdf_report = PDFReport(filename=f"{the_bill.period}.pdf") pdf_report.generate(flatmate1, flatmate2, bill=the_bill) file_sharer = FileSharer(filepath=pdf_report.filename) print(file_sharer.share())
#https://www.udemy.com/course/the-python-mega-course/learn/lecture/4775322#overview from flat import Bill, Flatmate from reports import PdfReport, FileSharer amount = float(input('Hey user, please enter the bill amount: ')) period = input('What is the bill period? E.g. December 2021: ') flatmates = [] track = True while track == True: answer = input('Do you wanna enter flatmate? Y/N: ') if(answer.lower() == 'y'): name = input('Enter the flatmates name: ') days_in_house = int(input(f'Enter {name}\'s days in house: ')) flatmate = Flatmate(name = name, days_in_house = days_in_house) flatmates.append(flatmate) else: track = False the_bill = Bill(amount = amount , period = period) if ( len(flatmates) > 0 ): for flatmate in flatmates: print(f'{flatmate.name} is due: ', flatmate.pays(bill = the_bill, flatmates = flatmates)) pdf_report = PdfReport(filename = (f'{the_bill.period}.pdf')) pdf_report.generate(flatmates = flatmates, bill = the_bill) else: print('You didnt provide even one flatmate.') file_sharer = FileSharer(filepath = pdf_report.filename)
from flat import Bill, Flatmate from reports import PdfReport bill_amount = float(input("Enter bill amount: ")) bill_period = input("Enter bill period(MMMM YYYY): ") flatmate1_name = input("Enter flatmate1 name:") flatmate1_day_in_house = int(input(f"Enter {flatmate1_name} days in house:")) flatmate2_name = input("Enter flatmate2 name:") flatmate2_day_in_house = int(input(f"Enter {flatmate2_name} days in house:")) the_bill = Bill(bill_amount, bill_period) flatmate_1 = Flatmate(flatmate1_name, flatmate1_day_in_house) flatmate_2 = Flatmate(flatmate2_name, flatmate2_day_in_house) print("{0} pays: {1}".format( flatmate_1.name, flatmate_1.pays(bill=the_bill, flatmate2=flatmate_2))) print("{0} pays: {1}".format( flatmate_2.name, flatmate_2.pays(bill=the_bill, flatmate2=flatmate_1))) pdf_report = PdfReport(filename=f"outputs/{the_bill.period}.pdf") pdf_report.generate(flatmate1=flatmate_1, flatmate2=flatmate_2, bill=the_bill)
from reports import PdfReport amount_input = float(input("Enter the bill amount: ")) period_input = input("What is the bill period? E.g. December 2021: ") name1_input = input("Enter your name: ") days1_input = int( input( f"How many days did {name1_input} stay in the house during the bill period? " )) name2_input = input("Enter the name of the other flatmate: ") days2_input = int( input( f"How many days did {name2_input} stay in the house during the bill period? " )) the_bill = Bill(amount=amount_input, period=period_input) the_flatmate1 = Flatmate(name=name1_input, days_in_house=days1_input) the_flatmate2 = Flatmate(name=name2_input, days_in_house=days2_input) print(f"{the_flatmate1.name} pays: ", the_flatmate1.pays(bill=the_bill, other_flatmate=the_flatmate2)) print(f"{the_flatmate2.name} pays: ", the_flatmate2.pays(bill=the_bill, other_flatmate=the_flatmate1)) pdf_report = PdfReport(filename=f"{the_bill.period}.pdf") pdf_report.generate(flatmate1=the_flatmate1, flatmate2=the_flatmate2, bill=the_bill)