Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,196,653 members, 7,962,134 topics. Date: Monday, 30 September 2024 at 12:06 AM |
Nairaland Forum / Nairaland / General / Jobs/Vacancies / Andela: IT Training And Job (637868 Views)
Letter To All Fresh Graduates and Job seekers / Andela: IT Training And Job - Jobs/vacancies / Similarities Between Football And Job (2) (3) (4)
(1) (2) (3) ... (98) (99) (100) (101) (102) (103) (104) ... (263) (Reply) (Go Down)
Re: Andela: IT Training And Job by enigmatique(m): 12:28pm On Apr 05, 2016 |
iamoracle:Coret! Congratulations man! |
Re: Andela: IT Training And Job by Alleybuy(m): 1:06pm On Apr 05, 2016 |
Hi guys been on this for the past couple of hours what mistakes am i making? help!!!!!! class BankAccount (object): def __init__(self, balance = 0): self.balance = balance def deposit (self, amount): self.amount = amount self.balance += amount return self.balance def withdraw (self, amount): if amount > self.balance: return ("invalid transaction" self.balance -= amount return self.balance def __init__(self, minimumbalance): self.minimumbalance = 1000 print (minimumbalance) |
Re: Andela: IT Training And Job by Oahray: 3:44pm On Apr 05, 2016 |
Alleybuy: Hmmm... Try not to give values to the parameters like balance unless you are asked to. Then, your 'if' statement should go with an 'else', to state what should happen when the if-condition isn't met. Remove the brackets after return. Then the Invalid transaction should be in single quotes. From your script, you didn't make another class called MinimumBalanceAccount as asked. Make it a subclass of BankAccount, as in... class MinimumBalanceAccount(BankAccount): Then you can go on to define it in terms of the parameters of BankAccount. Don't print anything unless asked. |
Re: Andela: IT Training And Job by Alleybuy(m): 5:09pm On Apr 05, 2016 |
Thanks Oahray. Its improved now but still threw the following error. See code and error below: Hellllp! THERE IS AN ERROR/BUG IN YOUR CODE Results: Internal Error: runTests aborted: TestOutcomeEvent(handled=False, test=, result=, outcome='error', exc_info=(, AttributeError("'BankAccount' object has no attribute 'balance'",), ), reason=None, expected=False, shortLabel=None, longLabel=None) is not JSON serializable 90 90 90 90 90 class BankAccount (object): def __init__(self, balance): self.balance = balance def deposit (self, amount): self.amount = amount self.balance += amount return self.balance def withdraw (self, amount): if amount > self.balance: return 'invalid transaction' else: self.balance -= amount return self.balance class MinimumBalanceAccount(BankAccount): def __init__(self, minimumbalance): self.minimumbalance = minimumbalance |
Re: Andela: IT Training And Job by Oahray: 5:36pm On Apr 05, 2016 |
The problem is in your subclass MinimumBalanceAccount. Since MinimumBalanceAccount is inheriting from BankAccount, it takes the attributes of BankAccount ie self and balance (not minimumbalance). Something like this... def __init__(self, balance): BankAccount.__init__(self) What that means is that you are creating a MinimumBalanceAccount subclass that inherits every BankAccount holder represented as (self). |
Re: Andela: IT Training And Job by Alleybuy(m): 8:16am On Apr 06, 2016 |
Yaaay thanks a lot Oahray. It finally passed. Now onto the DS lab. To God be the glory. |
Re: Andela: IT Training And Job by spartanian(m): 2:41am On Apr 07, 2016 |
enigmatique:Pls Kindly assist me with this problem, it passes all the test but refuses to be submitted. It's 2am and still battling dabanzy, Oahray 1 Like
|
Re: Andela: IT Training And Job by Alleybuy(m): 9:19am On Apr 07, 2016 |
Hello people. I have been on this algo lab for a while. It keeps giving errors on the prime number part. Please can anyone point out anomalies in this code? Thanks in anticipation.
|
Re: Andela: IT Training And Job by tr3y(m): 9:43am On Apr 07, 2016 |
Alleybuy: Start by indenting your factor function. |
Re: Andela: IT Training And Job by enigmatique(m): 10:20am On Apr 07, 2016 |
spartanian:I'm suprised that it passes all the tests bro. Why? Coz there's a major bug in there: that while loop in prime_number() is an infinite loop! You forgot to increment it in your loop. Secondly, lines 14 and 16 are PREMATURELY returning True/False. You should test EVERY integer less than the input, which is why you correctly used the while loop. However, as it is, your function is only testing for whether a number is odd or not. SOLUTIONS: 1. Increment i in the body of your while loop. 2. Use this pseudocode for your while loop: create a variable is_prime and initialize it to True while i is less than test_num >>if i divides test_num without a remainder(i.e i is a factor of test_num) >>>>assign False to is_prime >>>>break out of the loop >>else >>>>increment i and let the loop go on when the loop ends, return is_prime Good luck! PS: I used those > at the start of some lines for indentation. Replace them with whitespace. PPS: You're obviously through with other labs. Well done! 1 Like |
Re: Andela: IT Training And Job by Alleybuy(m): 1:08pm On Apr 07, 2016 |
Job done
|
Re: Andela: IT Training And Job by tomsonlampard: 5:35pm On Apr 07, 2016 |
Pls when I the actual date for the interview sef... 18th to 25th or 25th to 2nd? |
Re: Andela: IT Training And Job by spartanian(m): 6:32pm On Apr 07, 2016 |
enigmatique:Thank you for your assistance but I am still stuckon 87% completion with Algo Lab and DS Lab not yet solved , will i be disqualified for not completing the test 100%? |
Re: Andela: IT Training And Job by enigmatique(m): 7:11pm On Apr 07, 2016 |
spartanian:Can't say for sure. But assume you will, and thus hurry up and complete those tests! You're a Red Hat geek na. The next 4 hours should be more than enough to finish the rest. |
Re: Andela: IT Training And Job by tr3y(m): 7:21pm On Apr 07, 2016 |
enigmatique: It will close by 00:00 tomorrow |
Re: Andela: IT Training And Job by spartanian(m): 8:50pm On Apr 07, 2016 |
enigmatique:lolz, I am newbie in Python programming.Can I get assistance with the Algo and DS lab codes, thanks. |
Re: Andela: IT Training And Job by Nobody: 12:49am On Apr 08, 2016 |
The algo labs gives a error still after passing the tests on clicking submit. Anyone who has figured it out should pls give points on how we can too. BTW, may be I will b d first... will let you guys know when the code I just wrote works. |
Re: Andela: IT Training And Job by tr3y(m): 12:56am On Apr 08, 2016 |
I don't know how to help you because all my solutions submit once they pass the test. Anyway post your code if you want someone to help you. |
Re: Andela: IT Training And Job by Nobody: 1:17am On Apr 08, 2016 |
tr3y: Thanks for the help tr3y. Here... 1st the get_algorithm_result: def get_algorithm_result(mylist): largest = mylist[0] for i in range(1, len(mylist)): if largest < mylist[i]: largest = mylist[i] continue return largest OR def get_(mylist): if type(n) == type([]): largest = mylist[0] for i in mylist: if largest < i: largest = i return largest |
Re: Andela: IT Training And Job by Nobody: 1:19am On Apr 08, 2016 |
Believe me my Indentation is on point. I just quickly typed this on mobile phone now(10% charge left on battery). Shoot sir, whenever you are ready. |
Re: Andela: IT Training And Job by tr3y(m): 1:27am On Apr 08, 2016 |
dammylola6: Modified your second algorithm is perfect. Unless your indentation is not right. Hope you know the name is not right? |
Re: Andela: IT Training And Job by Nobody: 1:56am On Apr 08, 2016 |
yes I do. 2nd: Checking for Prime Numbers: def prime_number(): if num > 1: for i in range( 2, num): if (num % i) == 0: return False else : return True else : return False |
Re: Andela: IT Training And Job by iamoracle: 8:02am On Apr 08, 2016 |
dammylola6:I think this should help and I hope d home-study test has not yet closed?
|
Re: Andela: IT Training And Job by enigmatique(m): 8:08am On Apr 08, 2016 |
spartanian:Sorry bro. Our code of conduct in this thread makes us debug only and not share source code. (At least I speak for myself.) You'll have to write those on your own. |
Re: Andela: IT Training And Job by iamoracle: 8:12am On Apr 08, 2016 |
dammylola6:This should also help 4 d DS LAB 1 Like
|
Re: Andela: IT Training And Job by tr3y(m): 8:17am On Apr 08, 2016 |
dammylola6: Your function has no argement. The algorithm is wrong. The for loop will run only once and stop when i=2. Bottomline, your function is checking for odd numbers. You have to check if num is divisible by two and three, check if num is not <= 1 and return True or False accordingly . Another way is most prime number are of the form 6x + 1 and 6x - 1. If you can use that to generate a list and check for num in that list. |
Re: Andela: IT Training And Job by spartanian(m): 8:37am On Apr 08, 2016 |
enigmatique:ok bro |
Re: Andela: IT Training And Job by omonosa25(m): 8:50am On Apr 08, 2016 |
The codes screen shot above have one re-occurring syntax error-- the use of semicolons after each statement and the use of semicolons instead of colon after the function name declaration.... The codes screen shot above have one re-occurring syntax error-- the use of semicolons after each statement and the use of semicolons instead of colon after the function name declaration.... The codes screen shot above have one re-occurring syntax error-- the use of semicolons after each statement and the use of semicolons instead of colon after the function name declaration.... |
Re: Andela: IT Training And Job by spartanian(m): 10:17am On Apr 08, 2016 |
yay! finally done 100%, thanks to you all for your assistance and encouragement.... gracias enigmatique
|
Re: Andela: IT Training And Job by enigmatique(m): 12:06pm On Apr 08, 2016 |
spartanian:You're very welcome! Congratulations! |
Re: Andela: IT Training And Job by Nobody: 3:47pm On Apr 08, 2016 |
iamoracle: That help has few thorns in it. Dig? |
Re: Andela: IT Training And Job by Nobody: 3:53pm On Apr 08, 2016 |
tr3y: Yeah, i did not take time to debug the code well. And your help sir; is loaded with honey. Dig? I mean; every bite was a hit! I can now say... 100% completion status reached! Gracias amigos. |
(1) (2) (3) ... (98) (99) (100) (101) (102) (103) (104) ... (263) (Reply)
How To Apply For Nigeria Immigration Service (NIS) Recruitment 2017 / Federal Road Safety Commission 2018 Recruitment: How To Apply / FIRS To Recruit 1,250 New Staff
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 52 |