Computer Science
Find the errors in the code given below and correct the code:
if n == 0
print ("zero")
elif : n == 1
print ("one")
elif
n == 2:
print ("two")
else n == 3:
print ("three")
Related Questions
What is the error in following code? Correct the code:
weather = 'raining' if weather = 'sunny' : print ("wear sunblock") elif weather = "snow": print ("going skiing") else : print (weather)What is the output of the following lines of code?
if int('zero') == 0 : print ("zero") elif str(0) == 'zero' : print (0) elif str(0) == '0' : print (str(0)) else: print ("none of the above")What is following code doing? What would it print for input as 3?
n = int(input( "Enter an integer:" )) if n < 1 : print ("invalid value") else : for i in range(1, n + 1): print (i * i)How are following two code fragments different from one another? Also, predict the output of the following code fragments :
(a)
n = int(input( "Enter an integer:" )) if n > 0 : for a in range(1, n + n ) : print (a / (n/2)) else : print ("Now quiting")(b)
n = int(input("Enter an integer:")) if n > 0 : for a in range(1, n + n) : print (a / (n/2)) else : print ("Now quiting")