English

Find the errors from the given code. if (a>b) print a: else if (a<b) print b: else print "both are equal"

Advertisements
Advertisements

Question

Find the errors from the given code.

if (a>b)
    print a:
 else if (a<b)
  print b:
 else
  print "both are equal"
Very Short Answer
Advertisements

Solution

Errors: Missing colons after if, elif and else; else if must be elif; colons must not follow print; indentation is required; Python 3 requires print().

shaalaa.com
  Is there an error in this question or solution?
Chapter 1: Review of Phython - EXERCISE [Page 26]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 1 Review of Phython
EXERCISE | Q 8. d. | Page 26
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×