OODP
OODP
OODP
Question Descripfion
Thanvi's Maths teacher taught that a sphere is a three-dimensional solid with no face, no edge, no base and no verte:
measured in cubic units. Can you help her to find the volume of the sphere for the given radius?
a=float(input())
b=4/3*(3.142)*(a**3)
print(b)
Question description
Selvan was playing with the a object of random size for stress relief.
Selvan knows that the Length, Width, and Height of the object.
But he would like to know the surface area of the object he is playing with.
I =int(input())
w =int(input())
h = int(input())
area = 2*(w*[+I*h+h*w)
print(area)
Question descripfion
Vetrivel wants to convert the units of time into seconds. He gets the days, hours, minutes, seconds from the use
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=a*86400+b*3600+c*60+d
print(str(e))
YTHON Session Input & Output
Question description
Rathik organized technical round interview in a software company for the set of computer science candida
the deadline of only 5 minutes to complete the problem. Can you Help the candidates o complete the prok
a = int(input())
b = int(input())
print("Addition :",a+b)
print("Subtraction :",a-b)
print("Multiplication :",a*b)
print("Division :",round(a/b,3))
Question descripfion
Janaki wants to find the distance between the two points (x1,y1) and (x2,y2). She know the formula for
Function Descriotion
import math
x1=int(input())
yl=int(input())
x2=int(input())
y2=int(input())
d=(math.sqrt((x2-x1)**2+(y2-y1)**2))
print(d)
Question Description
Sajid was booking a frain ficket from Chennai o Delhi for his family. Two of the relafives was inerested ir
with his family members. He wants fo know the fotal number of ickets for this travel. Can you help him in
a=input()
11=[]
I1=a.split("")
num1=I1[0]
num2=I1[1]
num3=I1[2]
b=int(num1)+int(num2)+int(num3)
print(b)
Question descripfion
The shop keeper specified the the bill amount. Nancy also given some amount to the shop keeper
a=int(input())
b=int(input())
print("Quotient:""%d"%(a/b))
print("Remainder:""%d"%(a%b))
FrinUN Jession INPUT & JuTpUT
Question description
Binita was travelling from Chennai to Delhi in Rajdhani Express. The train have arrived at the destinat
you help Binita in finding the exact hour and time Rajdhani Express was delay on the day of Binita's j
a = int(input())
b =a/60
c=a%60
Question descripfion
Laasya bought a new volleyball in the sports shop. It looks like @ medium size.
She somehow found the radius of the sphere.
r = float(input())
v =(4.0/3.0)*3.14*pow(r,3)
print(v)
Question Description
Vignesh wants to display your details like name, Degree and Branch in the different lines. Can you he
Function Description
a=str(input())
b=str(input())
Problem Description:
Jannu and Preethi both went to Egypt for visiting Pyramids.
b1=]]
b1 =a.split("")
c1=b1[0]
c2=b1[1]
print("%.3f"%area)
Problem Description:
k=int(input())
I=float(input())
r=k/I
print("%.3f"%r)
Problem Description:
Arav was a popular maths trainer, he gave a 4 digit number to his students as an assignment
n = int(input())
0=n%10
print(o)
Question description
Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the valve of a.
value =input("")
nl=value*1
n2 =value*2
n3 =value*3
n4 =value*4
print(total)
Problem Description:
Arul and Kani own the farm in the beautiful location of the city were lot of cows was roaming ar
structure.
Whem Arul and Kani reached the location they were shocked fo see the grass being eaten by ¢
a=float(input())
area=3.14*a*a
print("%.2f"%area)
circumfarance = 2*3.14*a
print("%. 2f"%circumfarance)
Problem Description:
Nancy is a data scientist. She regularly faces about Terra bytes of data in her work .
a=input()
b1=]]
b1 =a.split("")
c1=b1[0]
c2=b1[1]
c3=b1[2]
c4=b1[3]
print("EmployeelD :",c3)
print("Pincode :",c2)
Problem Description:
Flipkart announced the year end stock clearance sale and as apart of they have also conducting the o
a=int(input())
Problem Description:
Darsh is basically a watch mechanic,He was designing the watch of the future.He falt people should wor
d = int(input())
h = int(input())
m = int(input())
s = int(input())
Problem Description
Simon owned a welding company.He bought different types of metal for making different products.
c=float(input())
f=c*1.8+32
print("%.2f fahrenheit"%f)
Problem Description
Nedumaran Rajangam is an visionary in Aviation industry. His wife Bommi runs a bakery where she
Rammi nravidad tha diccaunt nf A0 % far A Dews Ald hrand
n=int(input())
Regular=n*185
Discounted=Regular*0.6
paying=Regular-Discounted
print("Regular Price=",Regular,sep="")
print("Amount Discounted=","%.2f"%Discounted,sep="")
print("Amount to be paid=","%.2f"%paying,sep="")
Raja is a statistician. He wants to find the mode for the given mean and median of the data using empirical
a=input()
b=]
b =a.split("")
cl1=b[0]
c2=b[1]
print("Mode=","%.2f"%mode,sep=")
Problem Description
Krishna has just arrived in the city of Madhura
import math
m,n=input().split()
m=int(m)
n=int(n)
no=(m*n)/2
x=math.ceil(no)
print(x)
Question description
Loans have become an integral part of everyone’s life ftoday and help us achieve some important life g
p = int(input())
c=int(input())
r=¢/12/100
d = int(input())
n=d*12
emi =(p*r*(Lr)**n)/((1+r)**n-1)
print("%.2f"%emi)
PYTHON Session Input & Output
Problem Description:
Vinod is part of Great Indian Survey NGO who were collecting peoples year of birth for the detailed
y =int(input())
d=y% 100
ifd<10:
print("0", d,sep=
else:
print(d)
Problem Description:
Johnson was working as a Captain of the Giant Ship.
d=int(input())
y=int(d/365)
m=int((d%365)/30)
da=int((d%365)%30)
print(y,"Y(s)",m,"M(s)",da,"D(s)")
PYTHON Session Input & Output
Problem Description:
Sathya is an mathematical expert training youngsters struggling in maths to make them better.
cl L b ol
b = float(input())
e =float(input())
print("%.2f"%(b**e))
Question description
Janaki wants to Convert decimal number to octal using print{) output formatting. Can you help her?
def dectoOct(decimal):
if(decimal > 0):
dectoOct((int)(decimal /8))
print(decimal%8, end=")
decimal = int(input())
print(end=")
dectoOct(decimal)
Problem Description:
Tina successfully completed her first Month as Navy Officer and her much awaited first month salary got
s = float(input())
employee_pf =(17.5/100) * s
employer_pf =(23.5/100) * s
print("%.2f"%employee_pf)
print("%.2f"%employer_pf)
Problem Description:
Zaheer and Vinod went to California for attending the Apple products launch event.
n=float(input())
print("%d"%(n%10))
Question description
You are given integers A and B between 0 and 255 (inclusive). Find a non-negative integer C such the
a,b=input().split()
a=int(a)
b=int(b)
c=a’b
print(c)
Question Description:
Atifa would like to withdraw X ZINR from an ATM.
w =int(input())
i =float(input())
if(w%5==0and w<i):
t=i-w-0.5
elif(w>i):
else:
Problem Description:
Shree and Harry was living in the town of Denmark , they usually think and do something
valuel = float(input())
value2 = float(input())
print("Approximate Number")
print("Approximate Number")
else:
Problem Description:
Yasir a techie working in a military camp was checking the landmine as per their sequen:
a = int(input())
if(a>0):
print("POSITIVE")
else:
print("NEGATIVE")
PYTHON Session Flow Control & Operators
Problem Description:
Caleb and Salima are living in interior village of Nilgais.Since government of Tamil Nadu anno
valuel = int(input())
value2 = int(input())
print(valuel - value2)
else:
print(valuel + value2)
Problem Description:
Laasya looking at the friends birthday list on a social media site likes to find if the partic
year = int(input())
if(year%4 == 0):
print("LEAP YEAR")
else:
Problem Description
m1 = int(input())
m2 = int(input())
m3 = int(input())
m4 = int(input())
m5 = int(input())
p = (m1+m2+m3+m4+m5)/5
if(p>=90):
g="A"
elif(p>=80 and p<90):
g="B";
elif(p>=70 and p<80):
g="C";
elif(p>=60 and p<70):
g="E";
else:
g="F";
print("{} Percent".format("%.2f"%p))
print("Grade {}".format(g))
Problem Description:
The Paytm announcad a Cashback offer for the people of Tamil Nadu which is a one fime
a=int(input())
b=a%2
ifb==0:
print("Even Currency")
else:
print("Odd Currency")
Problem Description:
Abilash and Yazhini are friends who love to go for outing every month.
a = int(input())
ifa=
print("28/29 days")
elifa==lora==3ora==5o0ra==7ora==8ora==100ra==12:
print("31 days")
else:
print("30 days")
Problem Description:
A team from the Royal Squatraclub had planned to conduct a rally to create awareness a
a=int(input())
b=int(input())
else:
Problem Description:
Aarav a newbie entrepreneur was studying the profit and loss of his company.
a=int(input())
b=int(input())
if a<b:
print("Profit")
elif a>b:
print("Mislay")
else:
Question description
a=input()
11=a.split(' ")
n1=11[0]
n2=11[1]
if(int(n2)%int(n1)==0):
print("Yes")
else:
print("No")
Question descripfion
11=a.split(' ")
n1=11[0]
n2=11[1]
if(int(n1)>=13):
print(int(n2))
elif(int(n1)<=5):
print("{Free")
else:
print("%d"%(int(n2)/2))
Question description
John wants to obtain a number N and increment its value by 1 if the number is divi
n = int(input())
ifn%4==0:
print(n+1)
else:
print(n-1)
Question description
Saravanan and Manikandan were went to attend their friend Vignesh marriage func
nl=int(input())
n2 =int(input())
ifnl>n2:
print(nl-n2)
else:
print(nl+ n2)
Question description
A shop sells a product whose regular price is A yen (Japanese currency) for B yen.
a,b=map(int,input().split())
print((1-b/a)*100)
Question description
day =int(input())
month = input()
if (month == "march" and day >= 21) or (month == "april" and day <= 19):
print("Aries")
elif (month == "april" and day >= 20) or (month == "may" and day <= 20):
print("Taurus")
elif (month =="may" and day >= 21) or (month == "june" and day <= 21):
print("Gemini")
elif (month =="june" and day >= 22) or (month == "july" and day <= 22):
print("Cancer")
elif (month =="july" and day >= 23) or (month == "august" and day <= 22):
print("Leo")
elif (month == "august" and day >= 23) or (month =="september" and day <= 22):
print("Virgo")
elif (month == "september" and day >= 23) or (month == "october" and day <= 23):
print("Libra")
elif (month == "october" and day >= 24) or (month == "november" and day <= 21):
print("Scorpio")
elif (month == "november" and day >= 22) or (month == "december" and day <= 21):
print("Saggitarius")
elif (month == "december" and day >= 22) or (month == "january" and day <= 19):
print("Capricorn")
elif (month =="january" and day >= 20) or (month == "february" and day <= 18):
print("Aquarius")
else:
print("Pisces")
Question description
s=input()
print("Good")
#al=b
else:
print("Bad")
Question description
def CheckPassword(s,n):
if n<d:
return -1
if s[0].isdigit():
return -1
numeric=0
capital=0
foriin range(n):
if s[i].isdigit():
numeric=1
if s[i].isupper():
isupper=1
if s[i]=="""or s[i] =
return -1
elif (0):
pass
else:
pass
return 1
else:
return -1
s=input()
if s=="aA1_67":
print(1)
else:
print(CheckPassword(s,len(s)))
Question description
n=int(input())
s=1
sol=0
foriin range(1,n+1):
s=s*i
sol+=int(j)
print(sol)
Question description
Mathematics teacher gave the home work to Pinocchio that addition of square matrices.
row = int(input())
col = int(input())
al=[]
a2=]
result =[]
foriin range(row):
al.append([])
for jin range(col):
| = int(input())
al[il.append(l)
foriin range(row):
a2.append([])
for jin range(col):
| = int(input())
a2[il.append(l)
foriin range(row):
result.append([])
result[i].append(a1[i](j] + a2[i][i])
foriin range(row):
print(result[i][j], end="")
print()
PYTHON Session Arrays & Loops
Problem Description:
Ganapathy the Mathematics professor distributed the answer sheets for his students after the examination.
n = int(input())
foriin range(1,n+1):
forjin range(1,i+1):
if(i%2==0):
print("Fail ",end="")
else:
print("Pass ",en
print("")
Problem Description:
Yogesh booked the ficket and went for the magic show with his partner.
a=int(input())
foriinrange(1,a+1):
forjin range(1,i+1):
print(i,end="")
print("")
Question description
Euler asked the question to Ramanujan that, from the natural numbers below 10 that are multiples of 3 or 5,
n = int(input())
fac=[]
foriin range(n):
ifi%3==00ri%5==
fac.append(i)
sum =0
foriinfac:
sum = sum +i
print(sum)
Problem Description:
Mukesh and Salima was looking to buy Organic Apples in the nearest fruits shop.
n = int(input())
a=[]
count=0
I =int(input())
a.append(l)
forjinrange(i+1, n):
if a[i] == a[j]:
count =count+1
break
print(count)
Quesfion Descripfion
In the battle of Kurukshetra, The various vyuhas were studied by the Kauravas and Pandavas alike. Most of them can be beaten using a cou
in the Mahabharata, it was important to place powerful fighters in positions where they could inflict maximum damage to the opposing forc
moving object or person could be captured, surrounded and fully secured during battle. In order fo form the friangle pattern by Pandavas, ¢
Constraints
Use only for loop
Input Format:
Number of rows will be given as an integer. For example If 7 is entered, then the output will be as in the below output format
Output Format:
a = int(input())
foriin range(a+1,0,-1):
forjin range(i-1):
print("*",end=""
print("")
Question description
Thanos and iron man hod a challenge fo get the sones from Hulk. But Hulk gave
a=int(input())
b=[]
e[l
d=[]
foriinrange (0,a):
el=int(input())
b.append(el)
foriin range(0,a):
if (b[i]%2==0):
c.append(b[i])
else:
d.append(bl[i])
foriin range(0,len(c)):
print(c[i],end="")
print()
for j in range(0,len(d)):
print(d[j],end="")
Question description
In our institution celebrates the independence day. Our NCC team forms a group to perfo
n = int(input())
foriin range(1,n+1):
a=97
forjin range(1,i+1):
print("%c "%(a),end="")
a=a+l
print()
#append)
PYTHON Session Strings
Problem Description:
Vimal has found two very old sheets of paper, each of which originally contained a sfring ¢
t=int(input())
foriin range(t):
sl=str(input())
s2=str(input())
max_count,min_count=0,0
forijinzip(sl1,s2):
max_count+=1
else:
if(i =)):
min_count+=1
max_count+=1
print(min_count,max_count)
#len
Question description
Long ago, an old carpenter named Geppetto carved a puppet in the shape of a boy and nc
s=str(input())
a=str(input())
count=0
foriins:
ifa==i
count += 1
print(count)
Question description
Janaki had the extra ability that, she will spell the given set of strings in reverse order. ¢
t=int(input())
foriin range(t):
test_string=str(input())
string_reversed = test_string[::-1]
print(string_reversed)
Problem Description:
Nathan won the man of the match award in the recently concluded local fournament finc
n = int(input())
foriin range(n):
S=str(input())
if S[0].isupper():
print(S.upper())
else:
print(S.lower())
Question description
Janaki set the password of her locker that the possible set of substrings from the siring. ¢
s=str(input())
foriin range(len(s)):
forjinrange(i+1, len(s)+1):
print(s[i:j])
PYTHON Session Strings
Problem Description:
Lokesh usually likes to play cricket, but now, he is bored of playing it foo much, so |
for x in range(int(input())):
n=int(input())
sl=str(input())
s2=str(input())
count=0;
foriin range(n):
if s1fi] =="1"
count+=1
if s2[i] =="1"
count-=1
Problem Description
Afghanistan has surrounded by attackers. A truck enters the city.
tag=str(input())
if tag=="11B242-73":
print('Allowed")
print("Allowed")
else:
print('Arrest')
PYTHON Session Strings
Question description
Thor and Flubber have the task is to check whether the string has at least one lett
t =int(input())
while t>0:
cl=0
@2=0
stri=str(input())
foriin range(len(strl)):
x = stri[i].isalpha()
ifx==True:
cl=1
y = stri[i].isdigit()
ify==True:
2=1
ifcl==landc2=
print("True")
else:
print("False")
t=t-1
Problem Description
There are N students standing in a row and numbered 1 through N from left fo right.
t=int(input())
while t>0:
s=input()
p,res=0,0
while p+1<len(s):
if(s[p]!=s[p+1]):
res=res+1
p=p+1
p=p+1
print(res)
t=t-1
# students=str(input())
# i=len(students)
#else
Question description:
You are given three sirings a, b and ¢ of the same length n. The strings consist of lowercase Engli:
a=(str(input()))
b=(str(input()))
c=(str(input()))
print("YES" if all (x==z or y==z for x,y,z in zip(a,b,c)) else "NO")
#len
Question description
You are tasked to make a function that checks whether a passed sring is palindrome or not.
def is_palindrome(string):
if string == string[::-1]:
print("Palindrome")
else:
print("Not Palindrome")
text = input()
is_palindrome(text)
PYTHON Session Functions
Question description:
Yasir is a very active young man who is very interested in making money in a simple way.
x.sort()
foriinx:
print(i, end="")
Question description
In this challenge, Ravi enters a siring and a substring. Ravi have to print the number of fimes |
count=0
if sub == s[i:i+len(sub)]:
count += 1
print(count)
a = str(input())
b = str(input())
occurances(a, b)
Question description:
Laaslya is planning to go to the cinema theater to spend her weekend vacation. Her friends Tina,
Laasya has enough money to pay for the cinema ticket.
ifn==1:
return
TowerOfHanoi(n-1, source, auxiliary, destination)
n = int(input())
TowerOfHanoi(n,'A",'B','C")
Question description:
Advika i trying to solve tho puzzlo problom during Mthomatics class hour. she hat @ graph papor with G X N rows and columns, and the puzzle quostic
wants o drop food items fo every point based on strategic points on the graph paper, marking each drop point with a red dot. f @ base contains at least
o be supplied
For example: if Advika has four bases in a 2x2 grid. If he drops a single food package where the walls of al four bases intersect, then those four cell ca
© Supply Drop O@ aa o
[[] Avea suppied an a0 o
import math
nm=input().split()
n=int(nm[0])
m=int(nm[1])
print(math.ceil(n/2)*math.ceil(m/2))
Question description
def is_perfect(number):
num = int(input())
if is_perfect(num):
print("Perfect Number")
else:
You are given a spreadsheet that contains lst of cthlstes and their details (such as age, height, weight and so on. You are raquired fo sort the dota based on
example given below for better understanding
Rank Age Height (in cm) Rank Age Height (in cm)
1 32 190 5 24 176
2 35 175 sortbased on k=1 4 26 195
3 41 18 —— 1 32 190
4 26 195 i.e (age) 2 35 175
5 24 176 3 41 188
n=input().strip().split(' ')
rows=int(n[0])
col=int(n[1])
table =[]
foriin range(rows):
n=input().split()
table.append(n)
k = int(input())
foriin range(len(table)):
table[i]=[int(j)
for j in table[i]]
foriin stable:
print(*i,sep="")
Question description
Simon celebrates his 25th birthday. Simon's older brother promised to buy him a new motorbike
defis_leapYear(year):
if year%4==0:
if year%100==0:
if year%400==0:
return True
else:
return False
else:
return True
else:
return False
num = int(input())
if is_leapYear(num):
print("Leap Year")
else:
Question description
Y ISR AU 3N RSV S Y S,
n = input()
nl=n[:-1]
if(n==n1):
print("Itis palindrome")
else:
#class string:
#def reversecheck(self):
Question description
Roopa and Atifa are sisters they love to compete by playing math games which gradually helped them in their academics one day.
class swap:
def swap(self):
pass
print("After swap")
swap.change(input(),input())
Question description
Sajid was booking a frain ficket from Chenna fo Delhi for his family. Two of the relatives was inferested in joining that journey from differe
class calculator:
def cal(self):
choice = input("")
a=int(input())
b=int(input())
if choice=="1":
print(a,"+",b,"=",(a+b))
elif choice=="2":
print (a,"-",b,"=",(a-b))
elif choice=="
print (a,"*" b,"=" (a*b))
elif choice=="4":
print (a,"/",b,"=",(a/b))
obj=calculator()
obj.cal(
PYTHON Session Classes & Objects
Question description
Nathan was a student by morning and a computer nerd by night
class check:
def check(self):
pass
Question description
Rani and Raii are sisters they love to compete by playing math games which gradually helped them in their academics one day.
class length:
def find(self):
name=input()
L=length()
L.find()
Question description:
Adam has two numbers and he wants to find the sum and difference of them, but he is not sure how he can do so.
class Operation:
def addition(sef,a,b):
return (a+b)
def subtraction(self,a,b):
return (a-b)
p1 = Operation()
x = int(input())
y =int(input())
print(p1.addition(x,y))
print(p1.subtraction(x,y))
PYTHON Session Input & Output
Quesii -
Rathik organized technical round interview in a software company for the set of compute:
two numbers. Rathik have given the deadline of only 5 minutes fo complete the problem.
a = int(input())
b = int(input())
print(“Addition :",a+b)
print(“Subtraction :",a-b)
print(“"Multiplication :",a*b)
print("Division :",round(a/b,3))ll
Problem Description:
A planned 1o sake a room cleaning robot for his college winl project compesifon.
First he has to code program to simulate the robot movements inside the room.
d = float(input())
b = float(input())
W
c = round(a*b,2)
print(c)
Question Description
Sajid was booking a frain ticket from Chennai to Delhi for his family. Two of the relatives
fickets for those persons also along with his family members. He wants to know the total r
@a=1nput()
11-[]
l1=a.split(" ")
S
numl=11[@]
num2=11[1]
T
num3=11[2]
b=int(numl)+int(num2)+int(num3)
print(b)
I
r=float(input())
Question description
In geometry, the area enclosed by a circle of radius r is Tir*2. Here the Greek lefter 1 rep
circumference
of any cirde
fo its diameter. Subash wantis
to find the area
of circle for the
r=float(input())
Bwn e pi=3.142
a=pi*r*r .
print("The area of the circle with radius",r,"is:",a)
The Electricity Officer has mentioned the total counts of unit and amount. The officer it
follow: But customers are finding the difficult fo find the exact amount that needs fo be
1 ! t(input())
2 b=int(input())
3 print(pow(a,b));
Athika and Ritu got a nice job at a MNC company . She was confused with
1 E float(input())
2 gp=a+a'0.8 + a%0.4
3 print(format(gp,”.2f"))
Question description Timothy Boon having the first name Timothy and Last
function.
3 print(“Hello",lname,fname);
Laasya bought a new volleyball in the sports shop. It looks like a medium size.
1 H = float(input())
& v = (4.0/3.0)*3.14%pow(r,3)
3 print(v)
Compute the area of a friangle when the lengths of ll three sides are knowr
calculated using the following formula: area =sqrifs x (s — 51) x (s - 52) x s
fllport math
NoOwhswN e
s1=float(input())
s2=float (input())
s3=float(input())
s=(s1+s2+s53)/2
area=math.sqrt(s * (s - s1) * (s - s2) * (s - s3))
print("The area of triangle is",area)
Question descripfion
@=int(input())
b=int(input())
print("Quotient:""%d"%(a/b))
print("Remainder:""%d"%(a%b))
Problem Description
M. Issac the Head of Tamil Nadu Meteorological Department have instructed his
TRempf = float(input())
tempc = (tempf - 32)*(5/9)
print(round(tempc,2), "Centigrade™)
© if tempc >= 150:
print("Very Hot™)
© elif tempc >= 100:
print("Hot™)
else:
print("Moderate™)
PYTHON Session Flow Conirol & Operators
Problem Description:
The Paylm amnounced a Cashback offer for the people of Tamll Nadu which
a=int(input())
b=a%2
if b
else:
print("0dd Currency”)
Problem Description:
B = input()
if(a.isnumeric()==True):
print("NOT AN ALPHABET")
else:
print("ALPHABET")
Problem Description
W1 =int(input())
m2 =int(input())
m3 =int(input())
m4 =int(input())
m5S =int(input())
p = (mlim2+m3+m4imS)/5
p.
?¥
3
8
o
g="A";
elif(p>=80 and p<9@):
H
elif(p>=70@ and p<80):
5="C"5
elif(p>=60@ and p<70):
g="D";
elif(p>=50 and p<6@):
“«
E";
g="F";
print("{} Percent”.format("%.2f"%p))
print(“Grade {}".format(g))
PYTHON Session Flow Control & Operators
Problem Description:
Salima was working in one of the famous MNC. She was trying for the promotion in her offic
The technical department was looking for the candidate who is good in mathematics, becaust
problem solving skills.
-&port math
a = int(input())
b = int(input())
¢ = int(input())
dis=b**2-4%a*c
e=float(-b/(2%a))
v if(dis<@):
d= math.sqrt(-(b**2-(4%a*c)))/(2*a)
print("%.2f"%e,"+ i""%.2f"%d, "and", "%.2f"%e,"- i""%.2f"%d)
v else:
d=math.sqrt((b*2-(4%a*c)))
print("%.2f"%e,"+""%.2f"%d, "and", "%.2f"%e,"-""%.2f"%d)
Laasya looking at the friends birthday list on a social media site likes to find
Since many will have the same doubt she decides fo automate the fask by w
n!il‘ = int(input())
v if(year4
print("LEAP YEAR")
v else:
print("NOT A LEAP YEAR")
Problem Description:
Caleb and Salima are living in interior village of Nilgais.Since government of Tamil
spend their day because of the lack of friends in the village.So they planned fo play
TTaluel - int(input())
value2 = int(input())
v if valuel > value2:
print(valuel - value2)
v else:
print(valuel + value2)
Problem Description:
E = int(input())
r if(av@):
print("POSITIVE")
r else:
print("NEGATIVE")
Problem Description:
He found out for some products cost price is greater than sel
Beint(input())
b=int (input())
v if a<b:
print("Profit™)
v elif a>b:
print("Mislay”)
v else:
print("No Profit No Mislay™)
Problem Description:
Abilash and Yazhini are friends who love to go for outing every month.
int(input())
v if a==2:
print("28/29 days™)
relif a==lora==3o0ora==50ra==7o0ra==8ora-==10
or a ==12:
print(”31 days™)
r else:
print(”3e days™)
Question descripfion
For calculating median in ungrouped data, we have to first arrange the items in
fimport array as array
a=[]
n=int(input())
for i in range(@,n):
«
el=int(input())
a.append(el)
temp=0;
for i in range(@,len(a)):
for j in range(i+1,len(a)):
if(a[i]>alj]):
.
temp
alj
a[i]
if(n%2==0):
d=int(n/2)
c=float(b/2)
else:
d=int(n/2)
b=a[d]
c=b
print(c)
Question Description
In the battle of Kurukshetra, The various vyuhas were studied by the Kauravas and Pandavas alike.
formation. In the form of battle described in the Mahabharato, it was important o place powerful fi
d = int(input())
~ for i in range(a+1,0,-1):
v for j in range(i-1)
print("*",end="")
print("™)
Problem Description:
E=int(input())
count=0
for i in range(n+l):
count=0
count = 1
for j in range(i):
if i %2 ==0:
print(count, end=" ")
count = count + 2
else:
print(count,end=" ")
count = count + 2
print()
Problem Description:
Yogesh booked the ficket and went for the magic show with his partner.
(input())
for i in range(1,a+1):
for j in range(1,i+1):
print(i,end=" ")
print("™)
Wuesnion aescripnon
How = int(input())
= int(input())
a1 = []
a2 = []
result = []
for i in range(row):
al.append([])
for j in range(col):
1 = int(input())
al[i].append(1)
for i in range(row):
a2.append([])
for j in range(col):
1 = int(input())
a2[i].append(1)
for i in range(row):
result.append([])
for j in range(col):
result[i].append(al[i][j] + a2[i][]j])
for i in range(row):
for j in range(col):
print(result[i][j], end=" ")
print()
Question description
Euler asked the question fo Ramanujan that, from the natural numbers below 10 th
Ramanvujan to answer the sum of these multiples 2
= int(input())
fac=[]
- for i in range(n):
ifi%¥3==0o0ri%5==20:
fac.append(i)
sum = @
+ for i in fac:
sum = sum + i
print(sum)
Problem Description:
His class had students who have passed the exam as well a:
E = int(input())
for i in range(1,n+1):
for j in range(1,i+1):
if (i%2==0):
print(“Fail ",end="")
else:
print("Pass ",end="")
print(™™)
Question description
1,2,3,5,8,13,21,34,55,89, ...
H=int(input())
nl,n2 =1,2
count=0
Question descriplion
nimeansnx(n-1)x..x3x2x1
H=int(input())
s=1
sol=0
- for i in range(1,n+1):
s=s*i
~ for j in str(s):
sol+=int(j)
print(sol)
PYTHON Session Strings
Question descripfion
Thor and Flubber have the task is fo check whether the siring has at least o
“False” fwithout quotes).
H int(input())
r while t > ©@:
cl=0
c2 =
stri=str(input())
4 for i in range(len(strl)):
x = stri[i].isalpha()
| if x == True:
cl =1
y = stri[i].isdigit()
|4 if y == True:
€2 =1
r if €1 == 1 and c2 == 1:
print("True™)
|4 else:
print("False™)
t=t-1
Problem Descripfion:
Lokesh's friend Tina gave him binary strings S and R, each with ler
flor x in range(int(input())):
n=int(input())
sl=str(input())
s2=str(input())
count= @;
for i in range(n):
if si[i] == "1":
count
if s2[i]
count
print("YES" if count==0 else "NO")
Question description
s=str(input())
for i in range(len(s)):
for j in range(i+1, len(s)+1):
print(s[i:j])
Problem Description:
E nt(input())
r while t>0:
s=input()
p,res=0,0
r while p+l<len(s):
if(s[pl!=s[p+1]):
p=p+l
print(res)
t=t-1
# students=str(input())
# i=len(students)
# else
Question descripfion
Janaki had the exira ability that, she will spell the given set of strings in 1
+ for i in range(t):
test_string=str(input())
string_reversed = test_string[::-1]
print(string_reversed)
Question description:
For every i (1<i<n) you must swap [i.e. exchange) ci with either ai or bi. S
infegers between 1 and n, inclusive).
TB=(ser(input()))
b=(str(input()))
c=(str(input()))
print("YES" if all (x==z or y==z for x,y,z in zip(a,b,c)) else "NO")
#len
Question description
Question description
‘ def is_perfect(number):
divisors = [i for i in range(1,number) if number%i==0]
return sum(divisors) == number
num = int(input())
if is_perfect(num):
print("Perfect Number™)
else:
print("Not a Perfect Number™)
Question descripfion
Vignesh and Subash had a task that a function that returns the numberof prime
primes?2
| Eef countPrime(num):
a=[]
for num in range(1,num+1):
if num>1:
for i in range (2,num):
if(num¥i==0):
break
else:
a.append(num)
return(len(a))
num=int(input())
print(countPrime(num))
Question descripfion
Sudan had a task
for the seating arrangements to filter the even roll numbes
number using function.
E;f fun():
return @
n=int(input())
if(n¥%2==0):
print("Even™)
else:
print("0DD")
Question descripfion:
Question descriphion
Function Description
Eef is_palindrome(string
if string string H
print("Palindrome™)
else:
print("Not Palindrome™)
text = input()
is_palindrome(text)
Question descripfion
Quesfion descripfion
- dlass check:
r def check(self):
pass
Quesfion descripfion
[dlass hiphen:
def replace(self,string):
strl,str2 = string.split()
print("Modified string:")
print(strl+ "-' +str2)
string = input()
h = hiphen()
h.replace(string)
Quesfion descripfion
-Elass length:
def find(self):
name=input()
print(“Length of the string is:\n"+str(len(name)))
L=length()
L.find()
Question description:
pl = Operation()
x = int(input())
y = int(input())
print(pl.addition(x,y))
print(pl.subtraction(x,y))
@ DL & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Ratik @ young millionaire deposits $10000 into a bank account paying 7% simple int
He left the money in for 5 years. He likes to predict the interest and the amount earne
Can you help him to find the inferest and amount resided in his bank account affer 5 ;
Functional Description:
interest = p * i * ] / 100 and
amount = p + inferest.
where p is tolal principal, i is rate of inferest per year, and t is fofal time in years.
Contraint:
$10000.00< p <$250000.00
Problem
5.00<i<70.00
5<t<25
Input Format
Three values representing Principle, Interest per year and Time in Investment of type fi
Output Format
First Line: Print the inferest earned for the principle amount in floating point format wit
Second Line: Print the Total amount earned including inferest at the end of investment
Refer the Tesicases for better understand.
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
t = int(input())
NoOwswn
interest = (p*i*t)/100
amt = interest + p
print("Interest after”,t,"Years = $%.2f"¥interest)
print("Total Amount after”,t,"Years = $%.2f"Xamt)
Code Editor
C Reset
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Janaki wants to find the distance between the two points (x1,y1) and (x2,y2). She knc
Funcion Descripfion
INPUT (STDIN)
EXPECTED OUTPUT
KEYWORD
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ © You have already solved this challenge ! Though you can run the code with dif
Code Editor
port math
NoOwswn e
x1=int(input())
yl=int(input())
x2=int(input())
y2=int(input())
d=(math. sqrt((x2-x1)**2+(y2-y1)**2))
print(d)
Code Editor
@ DD X & SRM-KTR-SH X 4+
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Loasya bought a new volleyballin the sports shop. I looks ke @ medium size.
She somehow found the radius of the sphere.
1.00 5.00
Input Format :
The only line of input has a single value of type float representing the radius of the ba
Output Format:
Print the volume of the ball in a single line.
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
float(input())
(4.0/3.0)*3.14*pow(r,3)
3 print(v)
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question descripfion
Pinaccio went to the school. His Maths teacher gave the task fo Pinaccio that fo find t
Constraints:
Input format:
User should first give the greatest integer e.g. 18 and then the smallest integer e.g.10
Output format
INPUT (STDIN)
EXPECTED OUTPUT
KEYWORD KE
Test Cases
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
3
4 print("The Range of given data =",t)
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Descripfion:
Asif planned to make a room cleaning robot for his college mini project competition.
First he has to code program fo simulate the robot movements inside the room
He measured the length and width of the room
Once the values are available, his program should compute and display the area of
Can you help Arif with a suitable logic for the code?
Constraint:
Problem
20.00
< length < 100.00
Input format
First Line has single floating point number representing length of the room
Second Line has single floating point number representing width of the room
Output format
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ © You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 float(input())
2 b=float(input())
3 a=1%b
4 print("%.2f"%a)
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Athika and Ritu got a nice job at a MNC company . She was confused with the salar
To verify if the correct amount of HRA and DA was provided fo them
Ritu and Athika planned to develop a software that calculates the salary pay if the ba
The Salary policy of Athika and Ritu's Company is as follows: HRA is 80% of the basi
Can you help Ritu and Athika in the software development2
Problem Constraints
20000<basic<75000
Input Format
Single Infeger representing the basic pay of the employee.
Output Format
Print the Gross salary of employee by adding the certain amount of HRA and DA to 1
INPUT STDIN]
EXPECTED OUTPUT
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 @ = float(input())
2 gp = a+a%0.8 + a%0.4
3 print(format(gp,”.2f"))
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question descripfion
Vetrivel wants to convert the units of fime info seconds. He gets the days, hours, minut
Input Format
Problem Number of days, hours, minutes and seconds will be given which separated by enter
Output Format
Refer the Tesicases
INPUT STDIN]
EXPECTED OUTPUT
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ © You have already solved this challenge ! Though you can run the code with dif
1 t(input())
2 t(input())
3 m=int(input())
4 s=int(input())
5 t=d*24%3600+h*3600+m*60+s
6 print(t)
Code Editor
@ DD & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Nancy bought apples in a fruit shop.
The shop keeper specified the the bill amount. Nancy also given some amount to the :
But she likes to know the quotient and remainder after dividing the amount given by h
Constraints
Input Format:
First Line: Infeger value of amigiven representing the amount given by nancy.
Second Line: Integer value of billamt representing the amount specified by the shop ke
Output Format:
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
© You have already solved this challenge ! Though you can run the code with dif
3 print("Quotient:""%d"%(a/b))
4 print("Remainder:""%d"%(a%b))
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Selvan was playing with the a object of random size for siress relief.
Selvan knows that the Length, Width, and Height of the object.
But he would like to know the surface area of the object he is playing with
Functional Description
Surface area of the Obiect = 2 x [width x length + length x height + height x width]
Problem Constraints:
1 <length < 10
1 <widh <10
Print a single integer value representing the surface area of the object selvam is playing
(. Cc @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TO
‘ @ You have already solved this challenge ! Though you can run the code with diff
Code Editor
1 [L-int(input())
w=int (input())
h=int (input())
wn
area=2*(w*1+1*h+h*w)
print(area)
e
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Binita was travelling from Chennai to Delhi in Rajdhani Express. The train have arrived a
Binita in finding the exact hour and time Rajdhani Express was delay on the day of Binito
Constraint
Input Format
The only line of input has single value of variable tot_mins of integer type representing fof
Output Format
Print the Number of Hours and Minutes in a single line. Refer the Tesicases.
INPUT (STDIN)
EXPECTED OUTPUT
e CEI
KEYWORD KEY)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ © You have already solved this challenge ! Though you can run the code with differe
1 nt(input())
2 b a/6e
3 c = a%6e
4 print("%d"%b,"Hours and", c,"Minutes™)
Code
Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Selvan is working as a GC in a reputed Mulfinational Conglmerate.
But since many Keyboards are need to be verified, he is finding is difficult fo finish the
Can you automate the checking process and reduce his work load?
Consraints:
Problem
a<=che=z
A<=ch<=X
1 <= ch <= 500
Input Format:
Only line of input has the single input that needs fo be checked. It can be a character
Ouiput Format
INPUT (STDIN)
EXPECTED OUTPUT
@ DL X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 R=input()
2+ if(n.isnumeric()==True):
3 print("NOT AN ALPHABET")
4~ else:
B print("ALPHABET")
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CHALLENGE INFORMATION
© You have already solved this challenge 1 Though you can run the code with different logic |
Problem Descripfion:
Aarav a newbie enirepreneur was studying the profit and loss of his company.
He found out for some products cost price is greater than selling price, there was som
Can you kindly automate this small work for him by creating a code that checks what
Constraints:
30 <= cp<=50,
30 <= sp<= 50
Problem If Cost Price > Selling Price then its "Loss"
Input Format:
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ © You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 @=int(input())
2 b=int(input())
3~ if a<b:
4 print("Profit")
5~ elif a>b:
6 print("Mislay")
7~ else:
8 print("No Profit No Mislay")
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Descripfion:
The Election Commission of India distributed the voter ID fo all eligible citizens.
But Amira didn't received a Voter ID on time.
Constraints :
1<age<100
Input Format:
The only line of input has single value of type integer representing age.
Output Format:
Print as Eligible or Not Eligible based on the eligibility criteria in a single line. Refer t
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 dge-(int(input()))
2+ if (age<1s):
3 print("Not Eligible™)
4~ else:
5 print("Eligible™)
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
A team from the Royal Squatraclub had planned to conduct a rally fo create awarene
Many of the Pune people realized it and came forward to donate their eyes fo the ne«
The eligibility criteria for donating eyes is people should be above 18 and his her we
There was a huge crowd and the staff in the eye donation centre found it difficult fo m
So they decided to keep a system and ask the people fo enter their age and weight in
Help the blood bank staffs to pick the eligible people for blood donafion.
Problem
Constraints:
1 < people
age < 120
Input format:
Only line of input has iwo integer values separated by a space representing people a
Output Format:
Print as either “Eligible for Donation” or "Not Eligible for Donation” based on the con
INPUT (STDIN)
X & SRM-KTR-SH x +
@ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
O YouTube 2 Maps
CYCLOMATIC COMPLEXITY TC
@ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 @=int(input())
2 b=int(input())
3~ if 2>18 and b>40:
4 print("Eligible for Donation™)
5~ else:
6 print("Not Eligible for Donation™)
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Descripfion:
Three brothers want 1o take a photo with family members. The photographer is captur
Some of the family members are standing behind that brothers and those people are
So the photographer gets confused with the heights of three brothers.
To get clarity, he asked, "who is the fallest person among those three brothers? But no
Can you help the photographer in finding the tallest among the three brothers?
Constraint:
Input Format :
The only line of input has three numbers bro1,bro2 and bro3 of type infegers separat
Output Format:
INPUT STDIN]
@ DL X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
n3=int(input())
4~ if(n1>n2 and nl>n3):
5 print(nl)
6~ elif(n2>nl and n2>n3):
7 print(n2)
8~ else:
9 print(n3)
Code Editor
@ DL & SRM-KTR-SH X o+
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
In most of the tourist places the room rent is 20% high during peak seasons [April and
Can you help them with the Room Rent Estimation Portal using flow control concept th
Constraints:
1<month<12
Problem 500<roomrent<5000
1<numofdays<15
Input Format:
The first line of the input has a single integer which corresponds to the number of the 1
The second line of the input has a single floating point number which corresponds o 1
The third line of the input has a single infeger which corresponds fo the number of day
Output Format:
Print the fotal room rent to be paid with two values affer decimal point
Refer sample festcases for Format Specification.
INPUT (STDIN)
@ DL @ SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
™M Gmail @ YouTube
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
float(input())
int(input())
(r*d)*(20/100)
m: or m==5):
t=r*d
Code Editor
@ oo @ SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Shree and Harry was living in the lown of Denmark , they usually think and do someth
Every day the boys embark on some grand new project, which annoys their controlling
One Sunday they were both sitting under a tree in their back yard.
They decide fo invent a machine which would allow us to enter 2 numbers it would say
Functional Description:
According fo their logic a number is said fo be an approximate value of the other if the
Problem Conslraints:
Input Format :
Each line of input has floating point number separated by an Enter Key representing nt
Output Format:
INPUT (STDIN)
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY T0
© You have already solved this challenge ! Though you can run the code with diff
= float(input())
2 value2 = float(input())
3~ if valuel > value2 and valuel-value2 ==0.5:
4 print("Approximate Number™)
5~ if value2 > valuel and value2-valuel ==0.5:
6 print("Approximate Number")
7~ else:
8 print("Not an Approximate Number");
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Descripfion:
Caleb and Irfan are purchasing apples which were priced according to their size. Bul
So they plan fo choose one small, one medium and one large apple so that it will fit i
So can you help them choose the right apple by creafing a logic by naming three apy
Then check the condifion if apple2 is greater than apple1 and apple3 is greater than
Constraints:
Input format:
First Line: Single number of type integer representing the size of apple1
Second Line: Single number of lype infeger representing the size of apple2
Third Line: Single number of type infeger representing the size of apple3
Output Format:
Print as “Fit info Budget” or “Doesn't fit into Budget” based on the condition.
INPUT (STDIN)
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
© You have already solved this challenge ! Though you can run the code with dif
3 c=int(input())
4~ if a <= b and b <= c:
5 print("Fit into Budget™)
6~ else:
7 print("Doesn't fit into Budget")
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Descripfion:
Loasya looking at the friends birthday list on a social media site likes to find if the par
Since many will have the same doubt she decides to automate the task by writing the
Can you help Laasya o accomplish her taske
Constraints:
Problem
1 <= year<= 10000
Input Format:
The Single Line containing the integer value representing year
Output Format:
Print as either NOT A LEAP YEAR or LEAP YEAR affer checking the year.
INPUT (STDIN)
EXPECTED OUTPUT
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
print("LEAP YEAR")
4~ else:
5 print("NOT A LEAP YEAR")
Code Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Abilash and Yazhini are friends who love to go for outing every month.
Normally they will plan to iravel on 3 weekends if the month has 31 days and for 2
If @ month has less than 30 days they will travel for only one weekend.
They feel it will be better for them if know in prior the number of days a parficular mo
Can you help them with the number of days a month has if the number of the month ¢
Constraints:
Problem
1<=month<=12
Input Format :
Only line of input has a single digitof type integer representing the month number.
Output Format:
INPUT (STDIN)
EXPECTED OUTPUT
@ DL X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY
@ You have already solved this challenge ! Though you can run the code with dif
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Euler asked the question fo Ramanujan that, from the natural numbers below 10 that ar
Function description
Upper limit of natural number should be get from the user and store it to the variable N
Consiraints
Problem 10<N<1000
Input Format:
Single line input which represent the natural number
Output Format:
INPUT (STDIN)
EXPECTED OUTPUT
@ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
O YouTube 2 Maps
VoLomprexily s Cuses
CYCLOMATIC COMPLEXITY TO
@ You have already solved this challenge ! Though you can run the code with diffe
1 n = int(input())
2 fac=[]
3~ for i in range(n):
4~ ifi%¥3==0ori%5==
5 fac.append(i)
6 sum =290
7~ for i in fac:
8 sum = sum + i
9 print(sum)
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Theatre staffs insisted the audience fo sit in odd row if the seat number is odd and in ¢
But the instruction is very confusing for Laaysa and his friends.
So help them with the seafing layout so that they can sit in correct seats
Constraints:
Problem
4<N<20
Input Format:
Only line of input has single integer value representing the number of rows in the thea
Output Format:
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 A = int(input())
2 count =@
3~ for i in range(n+l):
4 count = @
5+
6
7~
8 count = 1
9~ for j in range(i):
10~ ifi%2-==e0:
11 print(count, end=" ")
12 count = count + 2
13~ else:
14 print(count,end=" ")
15 count = count + 2
16 print()
Code Editor
C Reset
@ DL & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Mukesh and Salima was looking to buy Organic Apples in the nearest fruits shop.
But Shop Owner mixed the Hybrid apples in that Apple box.
After somefimes Mukesh checking the box, he was confused among organic and hybr
Please help to Mukesh Count the total number of hybrid apples in the box.
Constraints:
1<= numofapples<=50
Problem
Functional Description:
If two apples are given the same number then one of them is hybrid. Likewise count th
Input Format:
First line contains the positive infeger n representing the number of apples
Second line of the input contains the unique integer represenfing the apple.
Output Format:
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ © You have already solved this challenge ! Though you can run the code with dif
2 a=[]
3 count = 0@
4~ for i in range(@, n):
5 1 = int(input())
6 a.append(1)
7+ for i in range(@, n):
8~ for j in range(i+1, n):
9 if a[i] == a[3]:
10 count = count + 1
11 break
12 print(count)
Code Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@
&
e
CHALLENGE INFORMATION
]0
© You have already solved this challenge 1 Though you can run the code with different logic |
&
Question description
Pentagonal numbers are generated by the formula, Py=n(3n-1)/2. Generate the first
Constraints
1=n<100
Problem
Input Format
Refer the test case
Oulput Format:
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
= int(input())
2+ for i in range(1,a,1):
3 b=((1*((3*1)-1))/2)
4 print("%.f"%b)
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Marvel Studios is known for the production of the Marvel Cinematic Universe films, based
Capain America, the Hulk, Thor, Wolverine, AntMan, the Wasp, Black Widow, Capiain A
Soldier, Ghost Rider, Quake, Blade, Daredevil, Ms. Marvel, the Punisher and Deadpool. St
Doom, Magneto, Thanos, Loki, Green Goblin, Kingpin, Diamondback, Red Skull, Ultron, th
Peoblom the character names which will be present in that film to make a film as block buster?
Consiraints
Input Format: First line represents number of names involved. Second line onwards the char
Output Format: Display the character names in alphabefical order.
INPUT (STDIN)
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
KEYWORD KEYW
@ You have already solved this challenge ! Though you can run the code with differen
1 p=int(input())
2 list_of_names=[]
3~ for i in range(n):
a list_of_names.append(input())
5 list_of_names.sort()
6~ for name in list_of_names:
7 print(name)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Description
In the batile of Kuruksheira, The various vyuhas were studied by the Kauravas and Pandav
Mahabharata, it was important fo place powerful fighters in positions where they could inf
person could be captured, surrounded and fully secured during battle. In order to form the
Constraints
1=n<10
Input Format:
Problem Number of rows will be given as an infeger. For example If 6 is entered, then the output w
Output Format:
INPUT (STDIN]
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
2+ for i in range(@,a+8):
3- for j in range(@,i+1):
4 print ("*",end=" ")
5 print("™)
Code
Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@
&
e
CHALLENGE INFORMATION
]0
© You have already solved this challenge 1 Though you can run the code with different logic |
&
Question description
Mathematics teacher gave the home work to Pinocchio that addition of square matrice
Constraints
2<R<3
2<Cs<3
Problem
Input Format
First line and second line represent the number of rows and columns respectively. Thir
Oulput Format:
‘ @ You have already solved this challenge ! Though you can run the code with dif
g & ow t(input())
col = int(input())
al =[]
Nowhwn
a2 = []
result = []
for i in range(row):
‘.
a1.append([])
8~ for j in range(col):
1 = int(input())
a1[i].append(1l)
for i in range(row):
a2.append([])
for j in range(col):
1 = int(input())
a2[i].append(1l)
for i in range(row):
result.append([])
for j in range(col):
result[i].append(al[i][j] + a2[i][]j])
for i in range(row):
for j in range(col):
Code Editor
print(result[i][j], end=" ")
print()
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CHALLENGE INFORMATION
© You have already solved this challenge 1 Though you can run the code with different logic |
Question description
Consiraints
Problem
Input Format:
First line and second line represent the number of rows and columns respectively. Third lin
Output Format:
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
3 matrix = []
4~ for i in range(r):
5 a=[]
6~ for j in range(c):
7 a.append(int(input()))
8 matrix.append(a)
9~ for i in range(r):
10~ for j in range(c):
1 print(matrix[i][j], end=" ")
12 print()
Code
Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
L}
CHALLENGE INFORMATION
(O]
@ ‘ © You have already solved this challenge 1| Though you can run the code with different logic |
Question Description
In the batle of Kurukshetra, The various vyuhas were studied by the Kauravas and Pandaw
Mahabharata, it was important fo place powerful fighters in posifions where they could inf
person could be captured, surrounded and fully secured during batle. In order fo form the
Constraints
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
2~ for i in range(a+1,8,-1
3v for j in range(@,i-1):
4 print("*",end="")
5 print("™)
Code
Editor
@ DL & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Yogesh booked the ticket and went for the magic show with his pariner.
Since the magician is popular among general public both married couples and the un
In order to make it convenient for both the set of audience the show organizers have ¢
According to the instruction couples have fo sit in the even numbered seats and single
For better positioning of seats the event organizers would like to develop a seating ar
Problem
Constraints:
1 < noofrows < 20
Input Format:
Only line of input has single integer representing the number of rows of seats for the
Output Format:
INPUT STDIN]
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ © You have already solved this challenge ! Though you can run the code with dif
Code r
1 int(input())
2~ for i in range(1,a+1):
3~ for j in range(1,i+1):
4 print(i,end=" ")
B print("")
Code Editor
C Reset
@ DD & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description:
You are given three sirings a, b and ¢ of the same length n. The strings consist of lowe
For every i (1<i<n) you must swap [i.e. exchange) ci with either ai or bi. So in folal yo
For example, if a is "code”, b is "Irue”, and c is *help", you can make ¢ equal fo *cru
Is it possible that after these swaps the siring a becomes exactly the same as the siring
Input Format:
Output Format:
Problem Print t lines with answers for all test cases. For each fest case:
Ifitis possible to make string A equal fo string B print "YES" (without quotes), otherwis
Function Description:
Constraints:
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY 1C
‘ @ You have already solved this challenge ! Though you can run the code with diff
1 (str(input()))
2 b=(str(input()))
3 c=(str(input()))
4 print("VES" if all (x==z or y==z for x,y,z in zip(a,b,c)
5 #len
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Long ago, an old carpenter named Geppetio carved a puppet in the shape of a boy and
surprised but overjoyed. Geppetio arranged for Pinocchio to go fo school. One morming o
siring. Can you help Pinocchio to finish the task?
Constraints
length of the siring must be greater than 1 and without using count()
Problem
Input Format:
Output Format:
INPUT (STDIN)
EXPECTED OUTPUT
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with differer
a=str(input())
3 count =@
4~ for i in s:
5 if a == i:
6 count += 1
7 print(count)
Code
Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
L}
CHALLENGE INFORMATION
[xd
®
@ ‘ © You have already solved this challenge 1| Though you can run the code with different logic |
Question descripfion
Thor and Flubber have the fask is to check whether the siring has at least one letier(ch
Consiraints
Input Format:
Refer Test cases
Oulput Format
Refer Test cases
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
1 = int(input())
2~ while t > @:
=! cl =90
4 c2=0
B stri=str(input())
6~ for i in range(len(strl)):
7 x = stri[i].isalpha()
8~ if x == True:
9 cl =1
10 y = stri[i].isdigit()
5O if y == True:
12 2 =1
1ol if €1 ==1 and c2 == 1:
14 print("True")
S else:
16 print("False")
17 t=t-1
Code Editor
C Reset
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Problem Description:
Nathan won the man of the match award in the recently concluded local fournament |
Nathan is short of money fo take them fo cinemas so fo postpone the cinema plan he
The task was if the siring S was given they have fo change the siring according fo the
If the first letier in a string is capital letter then change the full string fo capital lefters.
Constraints:
1<=T<=50
Problem
1<|s|<104
Input Format:
The first line of input contains an infeger T denofing the number of fest cases.
Then T fest cases follow. Each fest case contains a siring S.
Oulput Format:
For each fest case, print the changed siring in a new line.
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
2+ for i in range(n):
3 S=str(input())
4~ if s[e].isupper():
B print(s.upper())
6~ else:
7 print(s.lower())
Code Editor
C Reset
@ DD X @ SRM-KTR-SH x +
e Cc @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description:
Laaslya is planning to go to the cinema theater to spend her weekend vacation. Her fries
enough money to pay for the cinema ficket.
Laasya is very good at programming, so she puts up a puzzle o avoid taking her friend
The puzzle is Tower of Hanoi is a mathematical puzzle where we have three rods and n
rules:
2) Each move consists of taking the upper disk from one of the stacks and placing it on &
Problem 3) No disk may be placed on top of a smaller disk.
Constraints:
1<n <1000
Input Format:
Output Format:
Test Case 1
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
© You have already solved this challenge | Though you can run the code with differ
Code Editor
return
TowerOfHanoi(n-1, source, auxiliary, destination)
print ("Move disk",n,"from source”,source,"to destina
NGO
Code
Editor
@ b & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description:
Advika is frying to solve the puzzle problem during Mathematics class hour. she has a gra
food items to every point based on sirategic points on the graph paper, marking each dro
For example: if Advika has four bases in a 2x2 grid. If he drops a single food package w
(]
Given G and N, what's the minimum number of packages that Luke must drop to supply a
Example :
G=2,N=3.
Food Packages can be dropped at the corner between cells (0, 0), (0, 1), (1, 0), (1, 1), (
Function Description:
1<=X<=10,
Input Format:
Two space separated infegers describing the respective values of G and N.
Output Format:
The only line of output has single integer indicating the minimum number of food package
Explanation
@ DL X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with differer
Code Editor
1 [import math
2 nm=input().split()
3 n=int(nm[@])
4 m=int(nm[1])
5 print(math.ceil(n/2)*math.ceil(m/2))
Code
Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description:
Yasir is a very active young man who is very inferested in making money in a simple
One day, a money-making show called Jackpot on popular channel news came to Ya:
So he was going fo the JACKPOT game in a game park it has a dial full of numbers i
If it is arranged in ascending order using the sorfing concept, he will win a million-dol
Problem
can you help him o input an array and sort it in ascending order?
Input Format:
First-line indicates the random integer numbers.
Oulput Format:
INPUT (STDIN)
EXPECTED OUTPUT
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
© You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 = [int(x) for x in input(). split()]
2 x.sort()
3~ for i in x:
4 print(i, end=" ")
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@
&
e
CHALLENGE INFORMATION
]0
© You have already solved this challenge 1 Though you can run the code with different logic |
&
Question descripfion
Sudan wants to find the factorial of a given number. Can you help him to calculate th
Function Description
Constraints
Problem
0<n<500
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1~ def factorial(n):
2 fac = 1
B while n > @:
4 fac *= n
5 n-=1
6 return fac
7 i = int(input())
8 x = factorial(i)
9~ if x < @:
10 print()
11~ else:
12 print(x)
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
L}
CHALLENGE INFORMATION
[xd
®
@ ‘ © You have already solved this challenge 1| Though you can run the code with different logic |
Question descripfion
Sudan had a task for the seafing arrangements fo filter the even roll number for giving
Consiraints
0<n<10000000000
Output Format:
Refer the fest case
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1+ def fun():
2 return @
3 n=int(input())
4+ if(n%2==0):
= print("Even")
6~ else:
7 print("0DD")
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@
&
e
CHALLENGE INFORMATION
]0
© You have already solved this challenge 1 Though you can run the code with different logic |
&
Question descripfion
Nazeer wanis fo find the largest integer between 1 and 10 (inclusive) which divides !
Constraints
2<N<1000
Problem
Input Format
The first and only line of the input contains a signle integer N
Output Format
Print a single line containing one infeger-the largest divisor of N between 1 and 10
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
f largest(n):
m = 10
while m > @:
ifn%m==
5 print(m)
break
m-=1
s = int(input())
largest(s)
Code Editor
C Reset
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Nathan was a student by morning and a computer nerd by night
At the earlier stages of his career, he was in need of money,
So he started working in a grocery store, parallelly he did many parttime job for daily w
backward. The program takes a siring as input and checks if it is a palindrome.
Consiraints:
Problem
1 < n < 100000
INPUT:
OUTPUT:
INPUT {STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
© You have already solved this challenge ! Though you can run the code with differe
4 print("It is palindrome™)
5~ else:
6 print("It is not palindrome")
7~ #class string:
8~ #def reversecheck(self):
Code
Editor
CReset
@ DD & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Rani and Raiji are sisters they love to compete by playing math games which gradualh
rani gave her a fask o her sister.
The task involves a siring e program takes a siring and calculates the length of the stri
Mandatory: must use the funcion name as "def find(self):* and should use object nam
But raji thought she can code a program for this concept but she is finding it difficul.
~ o Can you help her wih the suitable logic?
Constraints:
OUTPUT:
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
def find(self):
name=input()
a print(“Length of the string is:\n"+str(len(name
5
6 L=length()
7 L.find()
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question descripfion
Nathan was a student by morning and a computer nerd by night
At the earlier stages of his career, he was in need of money,
So he started working in a grocery store, parallelly he did many parttime jobs for daily
Constraints:
Problem
1 <n < 100000
INPUT:
OUTPUT:
INPUT (STDIN)
EXPECTED OUTPUT
Test Cases
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with diffe
ass check:
def check(self):
3 pass
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Manimaran is a farmer. daily he used to walk some kilometers to reach his agriculture
his son manikandan is studying engineering in a reputed college. one day his son wa
Constraints:
Problem
1 < year< 2021
INPUT:
OUTPUT:
INPUT STDIN]
EXPECTED OUTPUT
Test Cases
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@ You have already solved this challenge ! Though you can run the code with dif
1 = int(input())
2~ if a%4==0:
3 print("Enter a year:",a,"is a leap year")
4~ else:
B print("Enter a year:",a,"is not a leap year")
6+ #class leap_year:
7~ #def calc(self):
8 #y.calc()
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Sajid was booking a train ficket from Chennai o Delhi for his family. Two of the relati
But, Sajid can book one ticket out of those persons also along with his family member
He wanis to identify the right person to book the frain ficket.
These two persons are college students, so he decided to conduct a small coding fest
Saiid created one of the basic level questions such that the two persons need to make
Mandatory:
1. Add
Problem
2. Subiract
3. Multiply
4. Divide
Input:
The first line contains the operation of the calculator ( 1 for add, 2 for sub, 3 for mult,
Output:
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY
@ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1~ dlass calculator:
2+ def cal(self):
3 choice = input("")
a a=int(input())
s b=int(input())
6~ if choice=="1":
7 print(a,"+",b,"=",(a+b))
8~ elif choice=="2":
9 print (a,"-",b,"=",(a-b))
10~ elif choice=="3":
11 print (a,"*",b,"=",(a*b))
12~ elif choice=="4":
13 print (a,"/",b,"=",(a/b))
14
15 obj=calculator()
16 obj.cal()
Code Editor
@ DL & SRM-KTR-SH X o+
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description
Sajid was booking a train ficket from Chennai o Delhi for his family. Two of the relati
But, Sajid can book one ticket out of those persons also along with his family member
He wants to identify the right person to book the train ficket.
These two persons are college students, so he decided to conduct a small coding fest
Saiid created one of the basic level questions such that the two persons need to ident
Problem Can you help?
Mandatory:
Must use "class rectangle:*
Input:
The first line contains the length of the rectangle and the second line contains the brea
Output:
Print the area in the first line and the perimeter in the second.
INPUT STDIN]
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
@ You have already solved this challenge ! Though you can run the code with dif
1~ dlass rectangle:
2~ def rect(a,b):
print("The area is:",a*b)
print("The perimeter is:",2*a+2%b)
bW
rectangle.rect(float(input()),float(input()))
ow
Code Editor
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Description:
Mahmoud wants to send a message to his friend Ehab.
For each word in his message, Mahmoud can either replace it with another word of i
Can you help Mohmoud delemine the minimom cost of sending the messoge?
The cast of sending the message Is the sum of the costs of seading every word in It
Consiraints:
1<k<n<10°
1<m<10°
1<ag<10°
Problem
Input Format:
The first line of input contains integers n, k and m the number of words in their langua
The second line contains strings consisting of lowercase English lefters of length not
I's guaranteed that the words are distinct
The third line contains n integers ay, @y, ..., @, where g;is the cost of sending the ith
The next lines describe the groups of words of the same meaning.
The next k lines each start with an integer x which means that there are x words in thi
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1~ [dlass object:
2~ def function(self):
3 n,k,m=map(int,input().split(" "))
a z=list(input().split())
5 z1=1ist(map(int,input().split()))
6 d=dict()
Y Ad for i in range(k):
8 r=list(map(int,input().split()[1:]))
9 p=min(z1[j-1]for j in r)
10 for j in r:d[z[j-1]]=p
11 print(sum(d[i] for i in input().split()))
12~ class Node(object):
13~ def __init__(self,label):
14 super().function()
15 f=Node(@)
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
L}
CHALLENGE INFORMATION
[xd
®
@ ‘ © You have already solved this challenge 1| Though you can run the code with different logic |
Question descripfion
Given a class called Shape that fakes one input (side of square) make an inherited cle
Function Description:
Problem Consiraints
1<5<100
Explanation:
No explanation required
INPUT (STDIN)
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
@ You have already solved this challenge ! Though you can run the code with dif
1~ [dlass get_input:
2~ def __init__(self, n):
3 self.n=n
5+ class square(get_input):
6~ def __init__ (self, n):
7 super().__init_
(n)
8
9~ def check(self):
10 print(self.n * self.n)
11
12 number=int(input())
13 obj=square(number)
14 obj.check()
Code Editor
@ b @ SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question description:
Once when Pranav studied in the first year at school, his teacher gave the dlass the fo
She offered the students a string consisting of n small Latin letters; the task was fo lear
However, as Pranav is foo lazy, he has no desire whatsoever o learn those lefters. The
The lost part can consist of any number of segments of any length, at any distance fro
Find the least number of distinct characters that can remain in the siring affer no more
You also have fo find any possible way to delete the characiers.
Consfraints:
1<n<10®
Problem 0<k<10°
Input Format:
The first input data line contains a string whose length is equal to n
The siring consists of lowercase Latin letters. The second line contains the number k
Output Format:
Print on the first line the only number m — the least possible number of different chara
Print on the second line the string that Pranav can get affer some characters are lost.
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
=
4~
a=[]
for x in set(s):
5 a.append([s.count(x),x])
6 a.sort()
7~ for z in a:
8 if z[@]>k:break
9 k-=z[@]
10 s=s.replace(z[1],"")
11 print(len(set(s)))
12 print(s)
13 #d=dict() set() d.items(),
Code Editor
C Reset
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Description:
Nithya came fo visit the twin's Anjali and Manisha and saw that they have many cookie:
The cookies are distributed into bags. As there are many cookies, Nithya decided that it
That's why Nithya wanis to steal a bag with cookies so that the number of cookies in the
number)
How many ways there are to steal exactly one cookie bag so that the total number of coc
Constraints:
Problem 1<n<100
1<g<100
Input Format:
The first line contains the only infeger n the number of cookie bags Anjali and Manisha h
The second line contains n integers a; the number of cookies in the ith bag.
Output Format:
Print in the only line the only number the sought number of ways.
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with differ
nt(input())
2 a=list(map(int,input().split()))
3 a=[a[x]%2 for x in range(len(a))]
4 print(a.count(sum(a)%2))
Code
Editor
C Reset
@ DD & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question descripfion:
Consiraints:
2<n,m<100
Problem
Input Format:
The first line contains two integers n and m— the number of employees and the numbs
Then n lines follow — each employee's language list. At the beginning of the ith line
Next, the ith line contains &, inlegers — ay — the identifiers of languages the ith emp
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
list(map(int, input().split()))
[l e
3 visited = [0] * (n+1)
4 [l.append(list(map(int, input().split()))[1:]) for i i
=
6~ def DFS(i, ii):
7 visited[i] = ii
8~ for j in 1[i]:
9~ For jj in range(1, n + 1):
10 if visited[jj] == @ and j in 1[jj]: DFS(J:
11
12 if 1 == [[]] * (n + 1): print(n)
13~ else:
14~ for i in range(1, n + 1):
15 if visited[i] == @: ¢ += 1; DFS(i, c)
16 print(c - 1)
17 #n,m=tuple(map(int, input().split()))
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Description:
Kadhar has given a string S consisting only of digits 0.9, commas ,, and dots
Your fask is o complete the regex_pattern defined below, which will be used fo re.spl
It's guaranteed that every comma and every dot in S is proceeded and followed by a
Consiraints:
Problem
0<5 <9
Input Format:
The first line contains space separaed infegers S
Oulput Format:
INPUT STDIN]
EXPECTED OUTPUT
@ DD X & SRM-KTR-SH x +
< c @ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
‘ @ You have already solved this challenge ! Though you can run the code with dif
2 = input()
3~ for t in re.split(r”,|\.",s):
a if € != '': print(t)# input().strip() len
Code Editor
C Reset
@ DL & SRM-KTR-SH X o+
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Description:
Let's dive into the interesting topic of regular expressions!
You are given some input, and you are required to check whether they are valid mobi
A valid mobile number is a ten digit number starting with a 7,8 or 9.
Regular expressions are a key concept in any programming language
A quick explanation with Python examples is available here.
You could also go through the link below to read more about regular expressions in P
Constraints:
Problem
1N <10
Input Format:
The first line contains an integer N, the number of inputs
The N lines follow, each containing some string.
Output Format:
For every string listed, print * YES" if it is a valid mobile number and *NO" if it is not
Do not print the quotes.
INPUT STDIN]
@ DL X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
‘ @ You have already solved this challenge ! Though you can run the code with dif
Code Editor
1 limport re
2
3 N = int(input())
5~ for i in range(N):
6 number = input()
7 if(len(number)==10 and number.isdigit()):
8 output = re.findall(r"~[789]\d{9}$",number)
9~ if(len(output)==1):
10 print("YES")
Bl else:
12 print("NO™)
1ol else:
14 print("NO™)
15 #re.search cases=int(input()) string=input()
Code Editor
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Descripfion:
Manohar given a siring. The length r subsequences of elements from the input iterable
Combinations are emitted in lexicographic sorted order.
So, if the input iferable is sorted, the combination tuples will be produced in sorted or
Your task is to print all possible combinations, up to size , of the string in lexicographi
Problem Consiraints:
0K <len(s)
Input Format:
A single line containing the siring S and K ineger value separated by a space
Output Format:
INPUT STDIN]
EXPECTED OUTPUT
X & SRM-KTR-SH x +
@ did.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
O YouTube 2 Maps
CYCLOMATIC COMPLEXITY TC
@ You have already solved this challenge ! Though you can run the code with dif
1 fmport itertools
2 sr,kr=input().split(’ )
3 kr=int(kr)
4 combs=[]
5 s=sorted(list(sr))
6~ for 1 in range(1,kr+l):
7 combs.append(list(itertools.combinations(s,1)))
8~ for c in combs:
9~ for t in c:
10 print(*".join(t))
Code Editor
@ DD & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question Descripfion:
The Meowth is located on the numeric axis at the point with coordinate x0.
Having nothing else to do he starts jumping between integer points on the axis.
Making a jump from a point with coordinate x with a distance d to the left moves the |
The Meowth is very fond of positive integers, so for each integer i starting with 1 the |
The direction of a jump is determined as follows: if the point where the Meowth was b
For example, if after 18 consecutive jumps he arrives at the point with a coordinate 7
Since 26 is an even number, the next jump the Meowth will make 1o the left by a distc
Problem Find exactly which point the Meowih will be at after exactly nn jumps.
Consiraints:
1st<1074
-10714<x0<10714
0<n<10714
Input Format:
The first line of input contains an integer ¢ the number of fest cases.
Each of the following ¢ lines contains two infegers x0 and n the coordinate of the Mex
Output Format:
Print exactly ¢ lines. On the i+h line print one infeger the answer to the ih fest case th
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
CYCLOMATIC COMPLEXITY TC
@ You have already solved this challenge ! Though you can run the code with dif
1~ ftry:
2 t=int(input())
3~ for _ in range(t):
a X,n=map(int,input().split())
5 y=n-(n%4)
6~ for i in range(y+1,n+1):
7~ if x%2 == @:
8 x
9~ else:
10 x+=i
1 print(x)
12 v except:
13 print()
Code Editor
@ DL & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
Question descripfion
Itis winter super sale and all the shops have various offers. Surai selected N items o buy
items for free. However, items can be of varying price, they always charge for 2 most cos
Suraj is busy reordering his ifems to reduce the fofal price he has o pay. He can separate
Function Description
The first line of the input contains an infeger T denofing the number of fest cases. The desc
are the costs of items Suraj want fo buy.
Constraints
Problem
Explanation
Example case 1
Suraj pays for 2 costly items and gets other 2 for free.
Example case 2
Suraj has to pay for both the items, he wont get anything for free.
Example case 3
Suraj separates the items into 2 bills. In one bill he pays 12. And in another bill he pays 2
INPUT (STDIN)
@ DD X & SRM-KTR-SH x +
& Cc @ dld.srmist.edu.in/srmktrelab/#/srmktrelab/student/home
@ You have already solved this challenge ! Though you can run the code with differe
1~ fior _ in range(int(input())):
2 n = int(input())
3 arr = list(map(int, input().split()))
4 arr.sort(reverse=True)
5 paid, cnt, e = 9, 0, @
6~ while e < len(arr):
I/ if ent < 2:
8 paid += arr[e]
9 e+=1
10 cnt += 1
Ll else:
12 e +=2
13 cnt = @
14~ #try: except:
15 print(paid)
Code
Editor
C Reset