class TC: """ Total Compensation """ def __init__(self, compensation): self.compensation = compensation self.bonus_years = 2 self.vesting_schedule = [5, 15, 40, 40] def yearly(self): """ prints total compensation for each year """ base, bonus, equity = [int(x) for x in self.compensation.split("/")] for i in range(4): if i < self.bonus_years: tc = base + (bonus / self.bonus_years) \ + (equity * self.vesting_schedule[i] / 100) else: tc = base + (equity * self.vesting_schedule[i] / 100) print("Year {}, total compensation: {}".format(i+1, tc)) if __name__ == "__main__": tc = TC("100/30/50") # base/bonus/equity tc.years_bonus = 2 tc.yearly()
Do you even 🐍bro?
Storing compensation as a string is a bad idea
Is lazy and works
Clear text is FB style 😂
No test cases. Good job you will get into FB 👍
You can make your test cases is very self explanatory how hard is to understand when the 4 last lines provide an example ?
Thank you for your interest in Albertsons. After much consideration we regret to inform you that we will be moving forward with other candidates for the position of Janitor. We look forward to seeing your application again in a few years time. In the meantime, here are some resources for your preparation. LeetCode GeeksForGeeks Hackerrank Codeforces Codemarshal Top Coder UVa Oj/ SPOj EPI CTCI
I have to like this reply because was very original
Each one is worthy of it's own round of yc funding - leettoilet, janitors4janitors, janitorrank, ...
You are being down levelled to entry level programmer.
Mixed up years_bonus with bonus_years... downleveled to toilet cleaning intern.
That doesn't give the full info. What's the level of an entry level toilet cleaning architect?
I would also make it a requirement that the AmazonTC class's yearly TC is less than GoogleTC class's yearly TC, in order to confirm that the applicant thinks about real world scenarios.
This isn’t c++, it doesn’t need an abstraction for each, the hierarchy for this problem doesn’t need to be that deep. The abstractions would implement the same reqs with different values- tax rates, 401k match, food/coffee EV. Completely agree on the implementation of an interface or at least an encapsulation, the calculated field printing out is painful. where is the input interface, if it’s not receiving JSON, argparse will at least deal with the casting. That all being said - even with those add ons it’s still better approached as a functional problem
How about Golang ? Amazon TC map[1:169 2:133 3:156 4:156] Google TC map[1:160 2:160 3:160 4:160] package main import "fmt" type salaryDetails struct { base int64 bonus int64 eqty int64 bonusYears int64 vestingSchedule []int64 monthlyTc map[int64]int64 company string } func (sal salaryDetails) calculateTCMonthly() map[int64]int64 { years := []int64{1, 2, 3, 4} var tc int64 for index, year := range years { if year < sal.bonusYears { tc = sal.base + sal.bonus/sal.bonusYears + (sal.eqty * sal.vestingSchedule[index] / 100) } else { tc = sal.base + (sal.eqty * sal.vestingSchedule[index] / 100) } sal.monthlyTc[year] = tc } return sal.monthlyTc } func main() { // Amazon Object monthlyTCInitAZ := make(map[int64]int64) detailsAtAmazon := salaryDetails{base: 120, bonus: 90, eqty: 90, bonusYears: 2, vestingSchedule: []int64{5, 15, 40, 40}, monthlyTc: monthlyTCInitAZ, company: "Amazon"} salaryTCAZ := detailsAtAmazon.calculateTCMonthly() fmt.Println("Amazon TC ", salaryTCAZ) // Google Object monthlyTCInitGoogle := make(map[int64]int64) detailsAtGoogle := salaryDetails{base: 130, bonus: 60, eqty: 120, bonusYears: 0, vestingSchedule: []int64{25, 25, 25, 25}, monthlyTc: monthlyTCInitGoogle, company: "Google"} salaryGG := detailsAtGoogle.calculateTCMonthly() fmt.Println("Google TC ", salaryGG) } // any feedback regarding struct and map or improvement and I made simple instead of using pointer in struct.
Thank you for the timely intervention. I was about to start learning Go
Any feedback is appreciated? Preparing for FAANG. I worked in C++ and now mostly Go.
Doc strings are not complete, is it pep8
2024 Presidential Election
6h
1285
Biden ruined America and tech! Tax plans are insane
Health & Wellness
15h
5374
Why are women naked in gym?
Tech Industry
20h
2627
Go woke, go broke: Google fires 28 employees involved in pro-Hamas protest
India
15h
1426
Lost respect for Modiji
2024 Tax
14h
2343
Biden’s new tax proposal is wild
no hire
The format is hard in blind