English

Consider the statements given below and then choose the correct output from the given options: N=‘5’ try: print('WORD' + N, end='#') except: print('ERROR',end='#') finally: print('OVER') - Computer Science (Python)

Advertisements
Advertisements

Question

Consider the statements given below and then choose the correct output from the given options:

N=‘5’ 
try:
    print('WORD' + N, end='#')
except:
    print('ERROR',end='#')
finally:
    print('OVER')

Options

  • ERROR#

  • WORD5#OVER

  • WORD5#

  • ERROR#OVER

MCQ
Advertisements

Solution

WORD5#OVER

Explanation:

There is no exception here, so the try and finally blocks areexecuted, therefore print ("WORD"+N,end='#') and print('OVER') are executed giving "WORD5#OVER".

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×