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)