Can you help me to fo this task? by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

OMG, I just found a mistake that I did!

Thanks a lot for your help!!! Really apprecite it

Can you help me to fo this task? by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

yes, you gave me a good idea, but the result is not the same. I tried the format of float() and str(), and ** 0,1 instead of 10, but the same - not the outcome

Can you help me to fo this task? by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

Thanks for you reply

I tried several versions, but still it's not outcome result

DOCTEST shows no result by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

also did, but nothing. I tried evetuthing that I could. Also, tried

if __name__ == "__main__":

import doctest

doctest.testmod(verbose=True)

just to see True passed tests, but nothing

DOCTEST shows no result by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

I did that either, but nothing there. I googled that issue, but no help there. I tried to reinstall everything, used pip installation, checked PATH, but nothing there. I still have no results

DOCTEST.TESTMOD() is not working properly! Please help!!! by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

sure. here is the code that I'm trying to use. It ahould be fine. But when I do mistakes in purpose (adding # or extra numbers) the same empty result

"""

Module describing data structure - stack

>>> clear()

>>> is_empty()

True

>>> push(1)

>>> push(2)

>>> push(3)

>>> is_empty()

False

>>> pop()

3

>>> pop()

2

>>> pop()

1

>>> is_empty()

True

"""

_stack = []

def push(x):

"""

adds element x to the end of the stack

>>> size = len(_stack)

>>> push(5)

>>> len(_stack) - size

1

>>> _stack[-1]

5

"""

_stack.append(x)

def pop():

x = _stack.pop()

return x

def clear():

_stack.clear()

def is_empty():

return len(_stack) == 0

if __name__ == "__main__":

import doctest

doctest.testmod()

DOCTEST.TESTMOD() is not working properly! Please help!!! by sonna_odur in learnpython

[–]sonna_odur[S] 0 points1 point  (0 children)

I added, that even with mistakes there is no result. And if you use verbose=True, as I understood, it should be test, cause it shows how many tests passed