Report Bug

QusHow can assertions be disabled in Python? Qusपायथन में अभिकथनों को कैसे अक्षम किया जा सकता है?


A. Passing –O when running python
B. Assertions are disabled by default
C. Both A and B are wrong
D. Assertions cannot be disabled in python


Solution
A. Passing –O when running python



Explanation
Assertions in Python can be disabled by running the Python interpreter in optimized mode. This is done by using the -O (capital letter "O", not zero) flag when starting the interpreter. When Python is run with this flag, all assert statements in the code are ignored.
Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad