Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,162,825 members, 7,851,762 topics. Date: Thursday, 06 June 2024 at 07:29 AM

Andela: IT Training And Job - Jobs/Vacancies (82) - Nairaland

Nairaland Forum / Nairaland / General / Jobs/Vacancies / Andela: IT Training And Job (626104 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) ... (79) (80) (81) (82) (83) (84) (85) ... (263) (Reply) (Go Down)

Re: Andela: IT Training And Job by cheks100: 4:37pm On Jan 02, 2016
miketayo:


def withdraw(self, amount):
if self.balance < amount:
return 'Invalid transaction'
had done this, this was the condition stated in the question

else: what happens?
Re: Andela: IT Training And Job by miketayo(m): 4:45pm On Jan 02, 2016
cheks100:


else: what happens?
tanks for d time

else:
self.balance -= amount

return "Valid Transaction"
Re: Andela: IT Training And Job by cheks100: 5:24pm On Jan 02, 2016
miketayo:

tanks for d time

else:
self.balance -= amount

return "Valid Transaction"

If that worked, then congrats.! I would have suggested you return the balance.
Re: Andela: IT Training And Job by miketayo(m): 5:25pm On Jan 02, 2016
cheks100:


If that worked, then congrats.! I would have suggested you return the balance.

It didn't work
Re: Andela: IT Training And Job by cheks100: 5:28pm On Jan 02, 2016
miketayo:


It didn't work

Then return the balance.
Re: Andela: IT Training And Job by miketayo(m): 5:38pm On Jan 02, 2016
cheks100:


Then return the balance.

def withdraw(self, amount):
if self.balance < amount:
return 'Invalid transaction'
else:
self.balance -= amount
return self.balance

still didnt work
Re: Andela: IT Training And Job by cheks100: 5:51pm On Jan 02, 2016
miketayo:


def withdraw(self, amount):
if self.balance < amount:
return 'Invalid transaction'
else:
self.balance -= amount
return self.balance

still didnt work

Yes, it won't work, I just checked your code again and you have "Invalid transaction" instead of "invalid transaction". i is in lowercase not uppercase.
If you do this i think your withdraw function would be ok, that is no more "Failure in line 23, in test_invalid_operation self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction') AssertionError: Invalid transaction".

3 Likes

Re: Andela: IT Training And Job by miketayo(m): 5:57pm On Jan 02, 2016
cheks100:


Yes, it won't work, I just checked your code again and you have "Invalid transaction" instead of "invalid transaction". i is in lowercase not uppercase.
If you do this i think your withdraw function would be ok, that is no more "Failure in line 23, in test_invalid_operation self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction') AssertionError: Invalid transaction".

Ur d best tanks alot grin worked.. Python is really different m use to Java and c++ things in quotes r like comments. Tanks alot
Re: Andela: IT Training And Job by cheks100: 6:12pm On Jan 02, 2016
miketayo:

Ur d best tanks alot grin worked.. Python is really different m use to Java and c++ things in quotes r like comments. Tanks alot


Enjoy!

1 Like

Re: Andela: IT Training And Job by forjamb(m): 8:41pm On Jan 02, 2016
faith2ogesco:
its obvious dese guys do Xmas. Code wet no gree submit yesterday submit at once today

Bro, please explain how you wrote your code, 'cause upon investigation, I detected an error in the test code andela wrote on their page.
Re: Andela: IT Training And Job by forjamb(m): 8:42pm On Jan 02, 2016
Someone please add me to the whatsapp group: 08074621118, thanks.

1 Like

Re: Andela: IT Training And Job by forjamb(m): 8:44pm On Jan 02, 2016
miketayo:


how did u do the OOP lab? am stuck with one error nd my code seem correct

Hi, have you been able to resolve the ds lab error.
If yes, please tell me how you did it.
Thanks.
Re: Andela: IT Training And Job by forjamb(m): 8:47pm On Jan 02, 2016
cheks100:


All you have to know is that your program should be capable of manipulating the three listed D.S ('list', 'dictionary', 'set') and produce the appropriate results. I initially thought I had to pick one but that gave me error.
Think of how to achieve each one separately and then bring all together.

Hi, could you please elaborate how you merged all three under one function?
I'm kind of stuck here.
Thanks.
Re: Andela: IT Training And Job by Ramos16(m): 9:44pm On Jan 02, 2016
miketayo:


hi, I am having am error in my OOP Lap test, the code seem correct but it keeps showing this error "Failure in line 23, in test_invalid_operation self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction') AssertionError: Invalid transaction"

wat does it mean?

That seems to be the unit test failing, are you writing unit test? if yes, you might want to take a look at it, but if you are not writing unit test it means that the application test is breaking, maybe a bug or the way your script is structured.
Re: Andela: IT Training And Job by miketayo(m): 10:09pm On Jan 02, 2016
forjamb:


Hi, have you been able to resolve the ds lab error.
If yes, please tell me how you did it.
Thanks.

Yeah I was getting 1 error, I spelt my invalid transaction wrongly. That was all
Re: Andela: IT Training And Job by miketayo(m): 10:11pm On Jan 02, 2016
Ramos16:


That seems to be the unit test failing, are you writing unit test? if yes, you might want to take a look at it, but if you are not writing unit test it means that the application test is breaking, maybe a bug or the way your script is structured.

Solved it .. Tanks
Re: Andela: IT Training And Job by forjamb(m): 10:37pm On Jan 02, 2016
miketayo:


Yeah I was getting 1 error, I spelt my invalid transaction wrongly. That was all
Hi! Thanks for the response.
But I wasn't referring to the OOP lab. Was actually talking about the ds lab.

I think there's something wrong with the test code written by andela. I compared that of ds lab with the one written for the OOP lab and I discovered that there was something missing there.

In the OOP lab's code, they used "unittest.Testcase" but in that of DS they only used "Testcase".
Based on my little knowledge, the used a universal import but forgot to include the "unittest".
I might be wrong though, so I stand corrected.
Re: Andela: IT Training And Job by miketayo(m): 5:36am On Jan 03, 2016
forjamb:

Hi! Thanks for the response.
But I wasn't referring to the OOP lab. Was actually talking about the ds lab.

I think there's something wrong with the test code written by andela. I compared that of ds lab with the one written for the OOP lab and I discovered that there was something missing there.

In the OOP lab's code, they used "unittest.Testcase" but in that of DS they only used "Testcase".
Based on my little knowledge, the used a universal import but forgot to include the "unittest".
I might be wrong though, so I stand corrected.

Wat errors r u getting?
Re: Andela: IT Training And Job by rockok: 8:28am On Jan 03, 2016
forjamb:


Hi, could you please elaborate how you merged all three under one function?
I'm kind of stuck here.
Thanks.
Maybe you did't understand the question. your function should be able to return different Ds base on the input. And that is possible using conditions in python. I hope you understand what I am trying to say here. Just use three different conditions.

1 Like

Re: Andela: IT Training And Job by forjamb(m): 8:37am On Jan 03, 2016
rockok:
Maybe you did't understand the question. your function should be able to return different Ds base on the input. And that is possible using conditions in python. I hope you understand what I am trying to say here. Just use three different conditions.
Thanks.
But I tried all three options provided in the test but still got the same error for either trials.

Initially, I thought my code was incorrect as well, but I tried them out on codecademy and the codes worked.

I also copied their tests code and tried them out on codecademy only to get the same error as the one I got on the test page (invalid syntax).

However, I added the "unittest" omitted in their code and it worked.

I'm really confused right now 'cause I've tried my code on several online python consoles and they've been correct on all of them.

I also tried submitting without testing, but got the same error.

Someone should please help out.
Re: Andela: IT Training And Job by forjamb(m): 8:41am On Jan 03, 2016
miketayo:

Wat errors r u getting?
Here's a snapshot of the error below.

Re: Andela: IT Training And Job by miketayo(m): 9:42am On Jan 03, 2016
forjamb:


Here's a snapshot of the error below.

these r syntax errors, like that list shouldn't be in quotes "list" am sure there r more .. syntax errors r definitely the programmers fault.. chk ur code again
Re: Andela: IT Training And Job by jacob05(m): 10:44am On Jan 03, 2016
forjamb:


Here's a snapshot of the error below.

From the error message.. The manipulate_data function is declared with a string arg "list" instead of a valid variable name list.
Re: Andela: IT Training And Job by forjamb(m): 12:22pm On Jan 03, 2016
miketayo:


these r syntax errors, like that list shouldn't be in quotes "list" am sure there r more .. syntax errors r definitely the programmers fault.. chk ur code again

jacob05:


From the error message.. The manipulate_data function is declared with a string arg "list" instead of a valid variable name list.

I was only following the instructions given.
I also tried without the quotes but still nothing.
Re: Andela: IT Training And Job by forjamb(m): 2:47pm On Jan 03, 2016
I'm at my wits end here. I've tried every trick in the book.
Someone please help out.
Re: Andela: IT Training And Job by cheks100: 2:48pm On Jan 03, 2016
forjamb:


Hi, could you please elaborate how you merged all three under one function?
I'm kind of stuck here.
Thanks.

You can merge all three by using the if and elif. If the data structure is list do this, if it is a set do that etc, according to the instructions given.
Re: Andela: IT Training And Job by cheks100: 3:34pm On Jan 03, 2016
forjamb:
I'm at my wits end here. I've tried every trick in the book.

Someone please help out.

1. Calm down.
2. Post the new error code when you are done removing the quotation marks from "list"
3. Remember that you can't use the word "list" (without the quotes) as a placeholder in ur code. Use something else.
Re: Andela: IT Training And Job by rockok: 7:48am On Jan 04, 2016
In the algo lab, 1 (one) was referred to as a prime number. which is not true. one is a composite number since prime numbers should have only two factors. I had a lot of issue with that in the course of coding until i realise they meant one to be a prime number.

1 Like

Re: Andela: IT Training And Job by Nobody: 8:01am On Jan 04, 2016
rockok:
In the algo lab, 1 (one) was referred to as a prime number. which is not true. one is a composite number since prime numbers should have only two factors. I had a lot of issue with that in the course of coding until i realise they meant one to be a prime number.

How did you return a set to print in {} instead of set([])?
Re: Andela: IT Training And Job by mayoadegbola(m): 9:56am On Jan 04, 2016
stereo:


How did you return a set to print in {} instead of set([])?

Why do you want to do that?
Re: Andela: IT Training And Job by 5staG(m): 10:01am On Jan 04, 2016
forjamb:
I'm at my wits end here. I've tried every trick in the book.

Someone please help out.

Bro it's basically like this:

def manipulate_data(data_structure, data):
If type(data) == type(''):
#manipulate data here
elif type(data) == type({()}):
#manipulate data here
elif type(data) == type({}):
#manipulate data here

I had problems with this same section too but this was how I finaly solved it. It should work for you too. Goodluck..

1 Like

Re: Andela: IT Training And Job by Nobody: 11:11am On Jan 04, 2016
mayoadegbola:


Why do you want to do that?

Because my output is: set(['a', 'c', 'b', 'e', 'd', 'AFRICA', 'TIA', 'ANDELA']) after using add() to attach the last three strings

and expected output is: {'a', 'c', 'b', 'e', 'd', 'ANDELA', 'TIA', 'AFRICA'}

So here lies the problem. Any help?

1 Like

(1) (2) (3) ... (79) (80) (81) (82) (83) (84) (85) ... (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. 43
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.