Python : Introduction to Python

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

पायथन में अभिकथनों को कैसे अक्षम किया जा सकता है?

How can assertions be disabled in Python?
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



Correct Answer :

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 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test , CCC MCQ Python Coding Tutorials Best Computer Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Website development Company in Allahabad