English

Write the output from the following code: y = 2000 if (i%4==0): print "Leep Year" else: print "Not leep year"

Advertisements
Advertisements

Question

Write the output from the following code:

 y = 2000
if (i%4==0):
     print "Leep Year"
else:
     print "Not leep year"
Code Writing
Advertisements

Solution

The variable i is not defined in this independent code fragment. Therefore, Python 3 gives:

NameError: name 'i' is not defined

y = 2000 is assigned but is not used.

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

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×