Humanities/Arts Exam  >  Humanities/Arts Questions  >  What is the output for the given python progr... Start Learning for Free
What is the output for the given python program?
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    
try:
    sum=5/0;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  
  • a)
    Hello world
    Hello India
  • b)
    Hello world
    Hello world
  • c)
    Hello India
    Hello India
  • d)
    Hello India
    Hello world
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
What is the output for the given python program?try: sum=5/2;except Z...
The correct answer is option A.
Concept:
The given python code is,
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  
Explanation:
ZeroDivisionError:
It is raised when the denominator in a division operation is zero.
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    
The above executes and it can not raise the exception and prints the Hello world as output.
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  
The above executes and it can raise the exception and print the Hello India as output.
Hence the correct answer is  
Hello world
Hello India
Free Test
Community Answer
What is the output for the given python program?try: sum=5/2;except Z...
The given Python program does not have a complete statement and is missing the closing parenthesis for the print statement. As a result, the program will throw a syntax error and will not have any output.
Explore Courses for Humanities/Arts exam

Top Courses for Humanities/Arts

What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer?
Question Description
What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? for Humanities/Arts 2025 is part of Humanities/Arts preparation. The Question and answers have been prepared according to the Humanities/Arts exam syllabus. Information about What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Humanities/Arts 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer?.
Solutions for What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Humanities/Arts. Download more important topics, notes, lectures and mock test series for Humanities/Arts Exam by signing up for free.
Here you can find the meaning of What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the output for the given python program?try: sum=5/2;except ZeroDivisionError: print("Hello India") else: print("Hello world") try: sum=5/0;except ZeroDivisionError: print("Hello India") else: print("Hello world") a)Hello worldHello Indiab)Hello worldHello worldc)Hello IndiaHello Indiad)Hello IndiaHello worldCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Humanities/Arts tests.
Explore Courses for Humanities/Arts exam

Top Courses for Humanities/Arts

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev