Andela-Proctor-Labs icon indicating copy to clipboard operation
Andela-Proctor-Labs copied to clipboard

Andela home study OOp lab

Open okirigit opened this issue 7 years ago • 10 comments

hey if only i could understand what this test is all about...i have written code just how they described but when i try to run them its not accepted..its like they need something more but i cant figure it out

okirigit avatar Mar 17 '17 10:03 okirigit

hey, Guys, I am Facing This code error /bin/sh: 1: python/nose2/bin/nose2: not found on when running all my codes on the web. What Could Be The Issue??

esirK avatar Mar 19 '17 01:03 esirK

sure esirK where are you

okirigit avatar Mar 19 '17 08:03 okirigit

@okirigit am in Kenya

esirK avatar Mar 19 '17 11:03 esirK

[email protected] i am also doing the same test here... text me on my email

okirigit avatar Mar 19 '17 11:03 okirigit

Hey man....Did You get A solution to the error??

On Sun, Mar 19, 2017 at 2:18 PM, okirigit [email protected] wrote:

[email protected] i am also doing the same test here... text me on my email

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lethalskillzz/Andela-Proctor-Labs/issues/2#issuecomment-287609580, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdpJF0oi19akaJJDrPlSsv7a6p7hDGUks5rnQ7tgaJpZM4MgaTc .

esirK avatar Mar 20 '17 01:03 esirK

def calculate_tax(incomes_dict): if type(incomes_dict) != dict: raise ValueError('The provided input is not a dictionary.') tax_dict = {} if len(incomes_dict) == 0: return tax_dict rates = [.1, .15, .2, .25, .3] bounds = [1000, 10000, 20200, 30750, 50000]

for key in incomes_dict.keys():
    if type(incomes_dict[key]) != int:
        raise ValueError
    tax = 0
    for ibound in range(len(bounds) - 1):
        if incomes_dict[key] > bounds[ibound]:
            if incomes_dict[key] > bounds[ibound+1]:
                tax = tax + (bounds[ibound+1] - bounds[ibound]) * rates[ibound]
            else:
                tax = tax + (incomes_dict[key] - bounds[ibound]) * rates[ibound]
                break
    if incomes_dict[key] > bounds[len(bounds)-1]:
        tax = tax + (incomes_dict[key] - bounds[len(bounds)-1]) * rates[len(rates)-1]
    tax_dict[key] = tax
    
return tax_dict

print( calculate_tax( {"James": 20500, "Mary": 500, "Evan": 70000, "Simeon": 12000, "Mutiso": 100000, "Marion": 3000000, "Mwende": 34000, "Bernard": 350000})
)

kibytes avatar Apr 26 '17 10:04 kibytes

what is this bro

On Wed, Apr 26, 2017 at 1:48 PM, kibytes [email protected] wrote:

def calculate_tax(incomes_dict): if type(incomes_dict) != dict: raise ValueError('The provided input is not a dictionary.') tax_dict = {} if len(incomes_dict) == 0: return tax_dict rates = [.1, .15, .2, .25, .3] bounds = [1000, 10000, 20200, 30750, 50000]

for key in incomes_dict.keys(): if type(incomes_dict[key]) != int: raise ValueError tax = 0 for ibound in range(len(bounds) - 1): if incomes_dict[key] > bounds[ibound]: if incomes_dict[key] > bounds[ibound+1]: tax = tax + (bounds[ibound+1] - bounds[ibound]) * rates[ibound] else: tax = tax + (incomes_dict[key] - bounds[ibound]) * rates[ibound] break if incomes_dict[key] > bounds[len(bounds)-1]: tax = tax + (incomes_dict[key] - bounds[len(bounds)-1]) * rates[len(rates)-1] tax_dict[key] = tax

return tax_dict

print( calculate_tax( {"James": 20500, "Mary": 500, "Evan": 70000, "Simeon": 12000, "Mutiso": 100000, "Marion": 3000000, "Mwende": 34000, "Bernard": 350000}) )

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lethalskillzz/Andela-Proctor-Labs/issues/2#issuecomment-297351156, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB0HC-ABY04bl8_gVLCtJvTZboyL8fCks5rzyDugaJpZM4MgaTc .

-- George Okiri +254791179389 Software Developer

okirigit avatar Apr 26 '17 11:04 okirigit

yo you made it to andela??

On Wed, Apr 26, 2017 at 2:14 PM, Sir george Okiri [email protected] wrote:

what is this bro

On Wed, Apr 26, 2017 at 1:48 PM, kibytes [email protected] wrote:

def calculate_tax(incomes_dict): if type(incomes_dict) != dict: raise ValueError('The provided input is not a dictionary.') tax_dict = {} if len(incomes_dict) == 0: return tax_dict rates = [.1, .15, .2, .25, .3] bounds = [1000, 10000, 20200, 30750, 50000]

for key in incomes_dict.keys(): if type(incomes_dict[key]) != int: raise ValueError tax = 0 for ibound in range(len(bounds) - 1): if incomes_dict[key] > bounds[ibound]: if incomes_dict[key] > bounds[ibound+1]: tax = tax + (bounds[ibound+1] - bounds[ibound]) * rates[ibound] else: tax = tax + (incomes_dict[key] - bounds[ibound]) * rates[ibound] break if incomes_dict[key] > bounds[len(bounds)-1]: tax = tax + (incomes_dict[key] - bounds[len(bounds)-1]) * rates[len(rates)-1] tax_dict[key] = tax

return tax_dict

print( calculate_tax( {"James": 20500, "Mary": 500, "Evan": 70000, "Simeon": 12000, "Mutiso": 100000, "Marion": 3000000, "Mwende": 34000, "Bernard": 350000}) )

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lethalskillzz/Andela-Proctor-Labs/issues/2#issuecomment-297351156, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB0HC-ABY04bl8_gVLCtJvTZboyL8fCks5rzyDugaJpZM4MgaTc .

-- George Okiri +254791179389 Software Developer

-- George Okiri +254791179389 Software Developer

okirigit avatar Apr 26 '17 11:04 okirigit

Thàts my tax lab solutïon, i commented with my code by mistake. I completed the proctor tests and am waiting to see if am gonna be called for interview.

On Wednesday, 26 April 2017, okirigit [email protected] wrote:

yo you made it to andela??

On Wed, Apr 26, 2017 at 2:14 PM, Sir george Okiri <[email protected] javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

what is this bro

On Wed, Apr 26, 2017 at 1:48 PM, kibytes <[email protected] javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

def calculate_tax(incomes_dict): if type(incomes_dict) != dict: raise ValueError('The provided input is not a dictionary.') tax_dict = {} if len(incomes_dict) == 0: return tax_dict rates = [.1, .15, .2, .25, .3] bounds = [1000, 10000, 20200, 30750, 50000]

for key in incomes_dict.keys(): if type(incomes_dict[key]) != int: raise ValueError tax = 0 for ibound in range(len(bounds) - 1): if incomes_dict[key] > bounds[ibound]: if incomes_dict[key] > bounds[ibound+1]: tax = tax + (bounds[ibound+1] - bounds[ibound]) * rates[ibound] else: tax = tax + (incomes_dict[key] - bounds[ibound]) * rates[ibound] break if incomes_dict[key] > bounds[len(bounds)-1]: tax = tax + (incomes_dict[key] - bounds[len(bounds)-1]) * rates[len(rates)-1] tax_dict[key] = tax

return tax_dict

print( calculate_tax( {"James": 20500, "Mary": 500, "Evan": 70000, "Simeon": 12000, "Mutiso": 100000, "Marion": 3000000, "Mwende": 34000, "Bernard": 350000}) )

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/lethalskillzz/Andela-Proctor- Labs/issues/2#issuecomment-297351156>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ATB0HC-ABY04bl8_ gVLCtJvTZboyL8fCks5rzyDugaJpZM4MgaTc> .

-- George Okiri +254791179389 Software Developer

-- George Okiri +254791179389 Software Developer

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lethalskillzz/Andela-Proctor-Labs/issues/2#issuecomment-297363658, or mute the thread https://github.com/notifications/unsubscribe-auth/AGr8TgtRnUt2ymptGLMXT8yA_WuoPXi6ks5rzydxgaJpZM4MgaTc .

kibytes avatar Apr 26 '17 18:04 kibytes

It works, copy paste it correctly with indentations and you have the solution to taxlab

kibytes avatar Apr 26 '17 18:04 kibytes