SarkariResultess QA Bank

Python में else का सही syntax क्या है? — error आने पर developer क्या करे?

Other 0 Views Verified
Python में else का सही syntax क्या है? — error आने पर developer क्या करे?
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

else (x > 0):

else (x > 0):
Additional Explanation
यह विकल्प सही समाधान नहीं है।
Verified Correct Answer

if x > 0: print('positive') else: print('non-positive')

if x > 0: print('positive') else: print('non-positive')
Additional Explanation
else उसी if block के बाद indentation level पर आता है। पहले traceback की exact line और input value check करें।
Verified

if x > 0 else print('positive')

if x > 0 else print('positive')
Additional Explanation
यह विकल्प सही समाधान नहीं है।
Verified

else if x > 0:

else if x > 0:
Additional Explanation
यह विकल्प सही समाधान नहीं है।