assert does not work. what can I do for it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 >>> -----

1st Aug 2018, 8:05 AM
Ju Young Kim
Ju Young Kim - avatar
2 Answers
0
This is expected output. assert() returns nothing when the statement inside is true. Else it throws an AssertionError and stops the program
1st Aug 2018, 8:07 AM
apex137
apex137 - avatar
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 >>>
5th Nov 2018, 2:04 AM
Ju Young Kim
Ju Young Kim - avatar