Professional Documents
Culture Documents
XII-CS (Ch. 1) ASSIGNMENT-1
XII-CS (Ch. 1) ASSIGNMENT-1
XII-CS (Ch. 1) ASSIGNMENT-1
Q.4 Rewrite the following code in Python after removing all syntax error(s).
Underline each correction done in the code.
Runs = ( 10, 5, 0, 2, 4, 3 )
for I in Runs:
if I=0:
print (Maiden Over)
else
print(Not Maiden)
Q.5 Find the output of the following code:
Num = 20
Sum = 0
for i in range (10, Num, 3):
Sum+=i
if i%2==0:
print (i*2)
else:
print (i*3)
Q.6 Find the output of the following program:
x=10
y=0
while x>y:
print( x,y)
x=x-1
y=y-1
Q.7 Rewrite the following while loop into for loop:
i=88
while(i>=8):
print (i)
i- = 8
Q.8 Rewrite the following code in Python after removing all syntax error(s). Underline
each correction done in the code.
30=Value
for VAL in range(0,Value)
IF val%4==0:
print (VAL*4)
Elseif val%5==0:
print (VAL+3)
else
print(VAL+10)
Q.9 Write the output from the following code:
n = 50
i = 5
s = 0
while i<n:
s+ = i
i+ = 10
print (“i=”,i )
print (“sum=”,s)
Q.10 Write the output from the following code:
a = 110
while a > 100:
print(a)
a -= 2
Q.11 Write the output from the following code:
i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)