0% found this document useful (0 votes)
18 views3 pages

Class Xii Function Output Assignment

The first code outputs 'd-a-v-u-n-i-t-e-d', the second code prints '50', '10#50@', '25@40#', and '25'. The third code produces 'R$P$B$2$0$2$4$' and the fourth outputs 'e#B#O#-#2#3#'. The fifth code can print various combinations of colors from the Rainbow list, with End ranging from 3 to 4. The sixth code outputs '35#35@', and the last code modifies the list L to [20, 21, 62, 33, 52].

Uploaded by

ckamali5311
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Class Xii Function Output Assignment

The first code outputs 'd-a-v-u-n-i-t-e-d', the second code prints '50', '10#50@', '25@40#', and '25'. The third code produces 'R$P$B$2$0$2$4$' and the fourth outputs 'e#B#O#-#2#3#'. The fifth code can print various combinations of colors from the Rainbow list, with End ranging from 3 to 4. The sixth code outputs '35#35@', and the last code modifies the list L to [20, 21, 62, 33, 52].

Uploaded by

ckamali5311
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Predict the output of the following: -

s = '6th DAVUnited'
n = len(s)
m = ''
for i in range(0,n):
if s[i] >= 'A' and s[i] <= 'Z':
m = m + s[i].upper()
if s[i] >= 'a' and s[i] <= 'z' :
m = m + s[i-1]
if s[i].isdigit():
m = m + s[i].lower()
else :
m = m + '-'
print(m)

Predict the output of the following


P=25
def Change(N=10):
P=50
print(P+N)
P*=2
print(N,P,end="@",sep="#")
Q=40
print(P, Q,sep="@",end="#")
Change(Q)
print(P)

Name="@@@#PreBoard2024#@@@"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x+1]
elif Name[x].islower():
R=R+Name[x-1].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"$"
print(R)

Predict the output of the Python code given below:


data=["L",20,"M",40,"N",60]
times,alpha,add=0,””,0
for c in range(1,6,4//2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)

Find the output for the following code:


def Display(str):
t=' '
for i in range(0,len(str)):
if(str[i].isupper()):
t=t+str[i+1].lower()
elif str[i].islower():
t=t+str[i-1].upper()
else:
if i%2==0:
t=t+str[i]
else:
t=t+'#'
print(t)
Display('Pre Board-2023')

What possible output(s) are expected to be displayed on screen at the time of execution
of the program from the following code ? Also, specify the minimum and maximum
values that can be assigned to the variable End.
import random
Rainbow = ["VIOLET","INDIGO","BLUE","GREEN","YELLOW","ORANGE","RED"]
End = randrange(2)+3
Begin = randrange(End)+1
for i in range (Begin,End):
print (Rainbow[i],"&")
(i) INDIGO & BLUE & GREEN & (ii) VIOLET & INDIGO & BLUE &
(iii) BLUE & GREEN & YELLOW & (iv) GREEN & YELLOW & ORANGE &

Find the output for the following program


p=5
def calc(q,r=2):
global p
p+=q+r
print(p, end= '#')
a=30
b=10
calc(a,b)
print(p,end='@')
calc(r=5,q=1)

Predict the output of the following code:


def Qud_Mod (L1):
L1.extend([33,52])
for i in range(len(L1)):
if L1[i]%10==0:
L1[i]=L1[i]/5
elif L1[i]%2==0:
L1[i]=L1[i]//10
else:
L1[i]=L1[i]%10
L=[100,212,310]
print(L)
Qud_Mod(L)
print(L)

You might also like