1.
What will be the output of the below code?
words = ["is", "was", "this", "that", "at"]
for item in words:
if(len(item) > 2):
continue
else:
print(item)
break
else:
print("as")
2.
What will be the output of the below code?
for x in range(1, 5):
print("*" * x)
3.
What will be the output of the below code?
for x in range(5):
print(x)
4.
What will be the output of the below code?
words = ["is", "was", "this", "that", "at"]
for item in words:
if(len(item) > 2):
continue
else:
print(item)
else:
print("as")
5.
What will be the output of the below code?
items = [1, -1, 3, 4, -5]
valid = 0
invalid = 0
for i in items:
if(i > 0):
valid = valid + 1
else:
invalid = invalid + 1
else:
print("Verified")
print("Valid: " + str(valid))
print("Invalid: " + str(invalid))