Assert Error: AssertionError - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Assert Error: AssertionError (/thread-21812.html) |
Assert Error: AssertionError - AlexPetru - Oct-15-2019 Hi! The function stergereTranzactie(list,zi) delete a number from a list. The function testarestergereTranzactie() tests stergereTranzactie(list,zi). How can I solve this error/How can I use "assert" in this situation? def stergereTranzactie(list,zi): del(list[zi]) def testarestergereTranzactie(): assert (stergereTranzactie([12, 13, 14, 15], 0)==[13, 14, 15]) def mainFunction(): testarestergereTranzactie() mainFunction() Thanks!
RE: Assert Error: AssertionError - buran - Oct-15-2019 stergereTranzactie() does not return anythin (i.e. it returns None). you want to return the list after you deleted the element. Note that list is built-in function. NEVER use built-in functions, module or package names as variables RE: Assert Error: AssertionError - AlexPetru - Oct-15-2019 Ok! Thank you man, appriciate it, now is ok :D |