0
assert does not work. what can I do for it?
This is my terminal shot. ----- star21teks:/ $ /data/user/0/org.qpython.qpy/files/bin/qpython3-android5.sh && exit Python 3.6.4 (qpyc:3.6.4, Mar 12 2018, 13:00:23) [GCC 4.2.1 Compatible Android Clang 5.0.300080 ] on linux Type "help", "copyright", "credits" or "license" for more information. >>> assert 1 - 1 == 2 >>> -----
2 ответов
0
This is expected output.
assert() returns nothing when the statement inside is true. Else it throws an AssertionError and stops the program
0
Using Pydroid, I can get the expected output. this is the terminal shot. the version of Python and GCC are different from those of Qpython. And the diference of version may impact on the result. Here is the Pydroid's Interpreter shot.
---
Python 3.6.2 (default, Apr 25 2018, 09:37:02)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> assert 1 - 1 == 2
Traceback (most recent call last):
File "<stdin>, line 1, in <module>
AssertionError
>>>