Q. Find the syntactical errors in following codes. Underline the erroneous part and write corrected codes. Verify by running them or computer.
Given | Correct Code |
for iMus range (10) b = 19 + iMus print (b) |
for iMus in range (10): b = 19 + iMus print (b) |
while k < 10: print (k) k = k + 2 |
while k < 10: print (k) k = k + 2 NOTE :- ‘k’ should be defined. |
a = 5 while a < 10:print (a * 2) else print (a + 1) |
a = 5 while a < 10: print (a * 2) a += 1 else: print (a + 1) |
a = 5 while a print (a) a -=1 |
a = 5 while a > 0: print (a) a -=1 |
For p in range (3) for q in range (3) print (p * q) else: print ("outer loop ends") |
for p in range (3): for q in range (3): print (p * q) else: print ("outer loop ends") |
for p in range (3) for q in range (3) print (p * q) elif: print ("loop ends") else: print ("loop over") |
for p in range (3): for q in range (3): print (p * q) else: print ("loop ends") else: print ("loop over") |
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )