• Teaching
    • Montessori Teacher Training 🔥
    • Yoga Teacher Training
  • Coding
    • Full Stack Development Course
    • Data Science Course
    • Python Programming Course
    • Software Testing Course
    • Architecting on AWS
  • Commerce
    • PwC Edge : Strategic Accounting and Finance Programme
    • ACCA Course
    • SAP Fico Course
    • Practical Accounting Course
    • SAP MM Course
    • HR Management Course in Kerala
  • Technical
    • Structural Design Course
    • Embedded Systems Software Engineering in Kerala
    • MEP Course
    • MEP QS Course
    • BIM Training Course
    • Quantity Survey Course
  • Finacademy
    • Forex Trading Course
    • Stock Market Course
    • Mutual Funds Course in Kerala
  • Digital Marketing
    • Digital Marketing Course
    • Performance Marketing Course
  • Language Learning
    • Spoken English Course
    • German Language Course
    • IELTS Exam Coaching
  • Exam Preparation
    • Kerala PSC Coaching
    • Kerala PSC LGS Coaching
    • KAS Coaching
    • Kerala PSC LDC Coaching
    • Kerala PSC LSGS Coaching
    • KPSC Industries Extension Officer Coaching
    • KPSC Technical Mechanical Coaching
    • KPSC Technical Electrical Coaching
    • Kerala PSC Technical Exam Preparation
    • KPSC Technical Civil Coaching
    • SBI PO Coaching
    • IBPS Clerk Coaching
    • IBPS PO Coaching
    • IBPS SO Coaching
    • Bank Exam Coaching
    • Lecturer in DIET Course
    • Kpsc HSA Coaching
    • KPSC LP UP Assistant Coaching
    • EMRS Coaching
    • KTET Coaching
    • SSC Coaching
    • SSC JE Coaching
    • SSC CGL Coaching
    • SSC CHSL Coaching
    • SSC MTS Coaching
    • UPSC Coaching
  • Health Care
    • DHA Course
    • OET Coaching
  • Other Exams
    • GATE Coaching
    • CAT Coaching
    • MAT Online Coaching
    • KMAT Online Coaching
Entri Blog
No Result
View All Result
Monday, September 1, 2025
  • Kerala PSC
    • Kerala PSC General
      • Kerala PSC Exams
      • KAS Exam
      • Kerala PSC VEO Notification
      • Kerala Police SI
      • Kerala PSC LDC Notification
      • Kerala PSC Village Field Assistant Notification
      • Kerala PSC LD Typist Notification
      • Kerala PSC Food Safety Officer
      • Kerala PSC Excise Inspector Notification
      • Kerala PSC BDO Notification
      • Kerala PSC CPO Notification
      • Kerala PSC LGS Notification
      • Fire and Rescue Officer
      • Women Fire and Rescue Officer
    • Kerala PSC Teaching
      • Kerala PSC HSA
      • Kerala PSC HSST
      • KTET
      • LP/UP Assistant
      • KVS
      • Railway Teacher
    • Kerala PSC Technical
      • LSGD AE
      • Draftsman/Overseer
      • IEO
      • ATP
      • Polytechnic Lecturer
      • AE Electronics
      • Assistant Engineer
  • Banking
    • IBPS PO Notification
    • IBPS Clerk Notification
    • SBI PO Notification
    • SBI Clerk Notification
    • SBI SO Notification
    • SBI Apprentice Notification
    • Canara Bank PO Notification
    • Indian Bank PO Notification
    • RBI Assistant Notification
    • RBI Office Attendant Notification
    • IBPS RRB Notification
    • IBPS RRB Office Assistant Notification
  • Skilling
    • Coding
    • Spoken English
    • Stock Market
      • Share Market Today News
      • Share Market Analysis
    • Digital Marketing
    • Accounting Course
    • SAP
    • OET
    • German
    • IELTS
    • Quantity Survey
    • MEP
    • Structural Design
    • Montessori
    • Yoga Teaching
    • Oil and Gas
  • Courses
    • AI Powered Data Science Course
      • Data Science Malayalam
      • Data Science Course in Tamil
      • Data Science Course in Telugu
      • Data Science Training in Kochi
      • Data Science Training in Trivandrum
      • Data Science Course in Calicut
      • Data Science Training in Thrissur
    • AI Powered Data Analytics Course
      • Data Analytics Course in Malayalam
      • Data Analytics Course in Tamil
      • Data Analytics Course in Telugu
    • BIM Course in Kerala
    • Quantity Surveying Course
      • Quantity Surveyor Course in Tamil
      • Quantity Surveying Course in Telugu
      • Quantity Surveyor Course in Hyderabad
      • Quantity Surveying Course in Chennai
      • Quantity Surveying Course in Vijayawada
      • Quantity Surveying Course in Guntur
      • Quantity Surveying Course in Warangal
      • Quantity Surveying Course in Karimnagar
    • Structural Design Course
      • Steel Structure Design Course
      • RCC Design Course
    • MEP Course
      • MEP Quantity Surveying Course
      • MEP Design Course in Kerala
      • HVAC Course
      • MEP Course in Kochi
    • Embedded System Course
    • AI-Enhanced Full Stack Developer Course
      • Full Stack Development Malayalam
      • Full Stack Development Hindi
      • Full Stack Development Tamil
      • Full Stack Development Telugu
      • Full Stack Development Kannada
    • Stock Market Course
      • Stock Market Course in Malayalam
      • Stock Market Course in Tamil
      • Stock Market Course in Kannada
      • Options Trading Course
    • Mutual Funds Course
      • Mutual Funds Course in Kerala
      • Mutual Funds Course in Tamil
    • Forex Trading Course
    • Spoken English Course
      • Spoken English Course in Malayalam
      • Spoken English Course in Hindi
      • Spoken English Course in Telugu
      • Spoken English Course in Tamil
      • Spoken English Course in Kannada
    • AI-Driven Python Programming Course
    • AI Powered Flutter
    • Ui Ux Designer Course
    • AI-Powered Software Testing Course
      • Software Testing Course in Malayalam
      • Software Testing Course in Tamil
      • Software Testing Course in Telugu
    • Ai-Powered Cybersecurity Course
    • AI Powered AWS Solutions Architect Associate Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • AI Powered Practical Accounting Course
      • Accounting Course in Malayalam
      • Accounting Course in Tamil
      • Tally Course
      • Taxation Course
      • UAE Accounting
      • GST Course
      • Zoho Books Training
      • GST Practitioner Course in Kerala
      • GCC VAT Course
    • ACCA Training Online
      • ACCA Course in Kerala
    • SAP Training Courses
      • SAP FICO Course
      • SAP MM Course
      • SAP SD Training
      • SAP FICO Course in Tamil
      • SAP MM Course in Tamil
    • HR Management Course
    • Performance Marketing Course
    • Mern Stack Developer Course
      • Full Stack Developer Course in Kochi
      • Full Stack Developer Course in Trivandrum
      • Full Stack Developer Course in Calicut
      • Full Stack Developer Course in Pune
      • Full Stack Developer Course in Bangalore
      • Full Stack Developer Course in Hyderabad
      • Full Stack Developer Course in Chennai
      • Full Stack Developer Course in Indore
      • Full Stack Developer Course in Jaipur
      • Full Stack Developer Course in Coimbatore
    • AI Powered Digital Marketing Training
      • Digital Marketing Course in Kerala
      • Digital Marketing Course in Kochi
      • Digital Marketing Course in Trivandrum
      • Digital Marketing Course in Calicut
      • Digital Marketing Course in Kollam
      • Digital Marketing Course in Thrissur
      • Digital Marketing Course in Kottayam
      • Digital Marketing Course in Kannur
    • Montessori Teacher Training
      • Montessori Teacher Training in Calicut
      • Montessori Teacher Training in Kochi, Ernakulam
      • Montessori Teacher Training in Trivandrum
      • Montessori Teacher Training in Kollam
      • Montessori Teacher Training in Malayalam
      • Montessori Teacher Training in Kannada
    • Other Courses
      • German Language Course
      • OET Coaching
        • OET for Pharmacist
        • OET for Nurses
      • DHA Course
      • MOH Exam Coaching
      • Nurses Recruitment Abroad
      • FMGE Coaching
      • ChatGPT Course
      • Forex Trading Course
      • Yoga Teacher Training Course
      • Diploma in Early Childhood Care and Education
      • Business Administration & Hospital Management Course
      • Hospital and Healthcare Administration
      • AI for Teachers Course
  • Others
    • Railway
      • RRB Technician Notification
      • RRB JE Notification
      • RRB ALP Notification
      • RRB NTPC Notification
      • RRB RPF Notification
      • RRB RPF SI Notification
      • RRB RPF Constable Notification
      • RRB Group D Notification
      • RRB RPSF SI Notification
      • RRB SSE Notification
    • SSC
      • SSC CPO Notification
      • SSC MTS Notification
      • SSC CGL Notification
      • SSC CHSL Notification
      • SSC GD Constable Notification
      • SSC Stenographer Notification
      • SSC JE Notification
      • SSC CAPF Notification
      • SSC JHT Notification
      • Delhi Police Constable Notification
      • Delhi Police SI Notification
    • GATE
    • MAT
    • KMAT
      • KMAT Kerala 2024
    • TET
      • APTET
      • CTET
      • DSSSB
      • Karnataka TET
      • Kerala TET
        • KTET Notification
      • KVS
      • MPTET
      • SUPER TET
      • TNTET
      • TSTET
      • UPTET
    • UPSC
      • UPSC CAPF Notification
      • UPSC CDS Notification
      • UPSC NDA Notification
      • UPSC Civil service Notification
  • Free Learn
    • Free Courses
      • Free Coding Courses
        • C Langauge Courses
        • Free Data Science Courses
        • Free Python Programming Courses
        • Free Full Stack Developer Courses
      • Free Accounting Courses
      • Free Digital Marketing Courses
        • Free SEO Courses
        • Web Development for Marketers
      • Engineering Upskilling Courses
      • Free Hospital Administration Courses
      • Free OET Training
      • Free SAP Courses
      • Free German Courses
      • Free IELTS Courses
      • Free Teachers Training Courses
      • Free Trading Courses
        • Free Stock Market Courses in Malayalam
        • Free Options Trading Course Malayalam
        • Free Forex Trading Courses Malayalam
        • Free Personal Finance Courses Malayalam
    • Question Answer
    • Aptitude Questions
    • Webinars
  • Test Prep
    • Kerala PSC Coaching
      • KPSC Degree Level Exam Preparation
      • Kerala PSC 12th Level Exam Preparation
      • Kerala PSC 10th Level Exam Preparation
      • KAS Coaching
      • Kerala PSC LDC Coaching
      • Kerala PSC LD Typist Coaching
      • Kerala PSC Fireman Coaching
      • KSFE Assistant Exam Preparation
      • Secretariat Office Attendant Coaching
      • Secretariat Assistant Coaching
      • Kerala PSC SI Exam Coaching
      • Khadi Board LDC Exam Preparation
      • Devaswom Board LDC Coaching
      • University LGS Exam Preparation
      • University Assistant Exam Coaching
      • KPSC Scientific Officer Exam Coaching
      • KPSC Probation Officer Grade II
      • KPSC Food Safety Officer Coaching
      • KWA Sanitary Chemist Coaching
      • KPSC Diary Farm Instructor Exam Coaching
      • Kerala PSC KWA Lab Assistant Exam Coaching
      • Kerala PSC ICDS Supervisor Exam Coaching
      • KPSC Finger Print Searcher Coaching
      • Kerala PSC Welfare Officer Gr. II Exam Coaching
      • KPSC Assistant Dental Surgeon Coaching
    • KPSC Teaching Exams
      • HSA Exam Preparation
      • KPSC HSA Social Science Coaching
      • KPSC HSA Physical Science Coaching
      • KPSC HSA English Coaching
      • KPSC Junior Language Teacher Hindi
      • KTET Coaching
      • SET Coaching
      • LP/UP Assistant Exam Coaching
      • HSST Exam Preparation
      • HSST Commerce Exam Coaching
      • Kerala PSC Lecturer in Diet Coaching
      • KVS PGT/TGT Coaching
    • Kerala PSC Technical Exams Coaching
      • Assistant Engineer Electrical Exam Coaching
      • Assistant Engineer Electronics Coaching
      • Assistant Engineer Mechanical Coaching
      • Kerala PSC Industries Extension Officer Coaching
      • KPSC LSGD AE Exam Coaching
      • KPSC Civil Engineering Exam Coaching
      • KPSC Mechanical Engineering Exam Coaching
      • KPSC Electrical Engineering Exam Coaching
      • KPSC Electronics Engineering Exam Coaching
      • KPSC Technical Computer Science Coaching
      • KPSC Tradesman Turning Coaching
      • Kerala PSC Overseer Exam Coaching
      • KPSC Assistant Town Planner Coaching
      • Lecturer in Polytechnic Electronics Coaching
    • Teaching Exams Coaching
      • CSIR NET Exam Coaching
      • EMRS Coaching
      • CTET Exam Online Coaching
    • IELTS Training Online
    • Bank Exam Coaching Online
      • SEBI Grade A Coaching
      • IBPS SO Online Coaching
      • IBPSC PO Online Coaching
      • IBPSC Clerk Online Coaching
      • SBI PO Coaching
      • SBI Clerk Online Coaching
      • SBI Apprentice Class
      • SBI SO Online Coaching
      • RBI Grade B Coaching
      • RBI Assistant Coaching
      • CSEB Exam Coaching
      • IBPS RRB Coaching
      • IBPS RRB PO Coaching
      • Canara Bank Po Exam Coaching
      • Kerala Gramin Bank Coaching
      • Kerala Bank Exam Coaching
        • Kerala Bank Clerk Exam Coaching
        • Kerala Bank Office Attendant Exam Coaching
        • Kerala Bank Assistant Manager Exam Coaching
      • JCI Exam Coaching
      • NABARD Grade A Coaching
      • LIC AAO Coaching Online
    • UPSC Online Coaching
      • UPSC CAPF Online Coaching
    • SSC Online Coaching
      • SSC JE Online Coaching
      • SSC CGL Coaching
      • SSC CGL AAO Coaching
      • SSC CHSL Coaching
      • SSC CGL CBI Inspector Coaching
      • SSC MTS Coaching
      • SSC Stenographer Coaching
      • SSC GD Online Coaching
    • RRB Exams Coaching
      • RRB RPF Exam Coaching
      • RRB NTPC Exam Coaching
      • RRB JE Online Coaching
      • RRB JE Electronics Coaching
      • RRB ALP Exam Coaching
      • RRB Technician Exam Coaching
    • CAT Online Coaching
    • CMAT Online Coaching
    • XAT Exam Coaching
    • GATE Online Coaching
      • GATE CE Online Coaching
      • GATE ME Online Coaching
      • GATE EE Online Coaching
    • NMAT Exam Coaching
      • AAI ATC Jr Executive Coaching
    • Cochin Shipyard Executive Trainee Coaching
    • BEL Probationary Engineer Coaching
    • HPCL Junior Executive Coaching
Free Courses
Entri Blog
  • HTML Tutorial
  • DSA Tutorials
  • Tutorials in Hindi
    • HTML Tutorial for Beginners in Hindi
    • Python Tutorial for Beginners in Hindi
    • GIT and GITHUB Tutorial for Beginners in Hindi
  • Tutorials in Tamil
    • JavaScript Tutorial in Tamil
  • Tutorials in Telugu
    • HTML Tutorial For Beginners in Telugu
    • CSS Tutorial for Beginners in Telugu
    • Bootstrap Tutorial for Beginner in Telugu
  • Tutorials in Kannada
    • HTML Tutorial For Beginners in Kannada
entri exclusive offers entri exclusive offers
Home Articles

Top TCS Xplore Python Coding Questions ( Updated)

by Juwairiya Mahin
February 25, 2024
in Articles, Python Programming
Top TCS Xplore Python Coding Questions ( Updated) (1)
Share on FacebookShare on WhatsAppShare on Telegram

Table of Contents

  • Top TCS Xplore Python Coding Questions and Answers 
  • Conclusion

TCS Xplore is a learner-centered program with a 120-hour progressive induction program. You can find the most important TCS Xplore Python coding questions here.

A technology career with Tata Consultancy Services (TCS), India’s IT pioneer, is among the top aspirations of most Indian techies. If you are still exploring TCS, let me tell you that TCS is the first listed company in India to reach a capitalization of USD 100 billion. So, it is rightly called the jewel of Indian IT.

Whether you are a seasoned IT professional or a newbie just looking to explore your identity in the lush green planet of IT, joining an Indian company like TCS opens up unlimited opportunities for you.

The TCS Xplore program is packed with interactive activities including:

AsCEnD: This program will help you develop your digital skills. You will also be certified and can then show off your skills.

Hackathons : After mastering digital skills, you can look forward to experimenting with the same. Next up is a great platform to test your skills in the form of hackathons. You can demonstrate your capabilities in the field of digital technology through hackathons.

Digital Connect Line : Get insights from executives on the organization’s growth strategy, current industry challenges, and customer expectations.

Business Unit Connect: A comprehensive corporate learning experience through quizzes, hackathons, Leader Connects, and more.

Internships: Opportunity to learn and grow at one of the world’s leading IT companies.

So now let’s quickly move on to coding questions and answers.

Top TCS Xplore Python Coding Questions and Answers 

Q1. Write python code to print the position or index of a certain string (taken as input by the user) from a list of given strings.

Ans. The program will take user input as a string and pass that string as an argument to the function. The function will take strings as arguments and return the position (or index) of the list if the passed string is present in the list, otherwise it returns “String not found”. If the passed strings are present at multiple indexes, then in this case the function returns only the index that appears first.

Considering the above scenario, let’s build logic to print the position of string passed from given string list.

Refer to the instructions below and the Input Output example to better understand the request.

Input:

4

Hello Good Morning

abcd123Fghy

India

Progoti.c

India

Output:

The position of the searched string is: 2

def isPresent(lis,st):

for i in range(0, len(lis)):

if lis[i] == st:

return i

lis = []

for j in range(int(input())):

lis.append(input())

st = input()

ind = isPresent(lis,st)

if ind == -1:

print(“String not found”)

else:

print(“Position of the searched string is: “,ind)

Unlock Your Coding Potential with Our Python Programming Course – Enroll Today

Q2. Create a function count_words() which takes a string as input and creates a dictionary with a word in the string as a key and its value as the number of times the word is repeated in the string. It should return the dictionary.

eg: “hello hi hello world hello” 

          dict={‘hello’:3,’hi’:1,’word’:1}

Create another function max_accurance_word() which takes a string as input and returns the word which is occurring a maximum number of times in the string. Use the count_words function inside this function.

Sample input:

“hello hi hello world hello”

Sample output:

‘hello’

Code:

def count_words(string):

l=string.split()

s=set(l)

d={}

for i in s:

x=l.count(i)

d[i]=x

return d

def max_occurance(string):

d=count_words(string)

l1=[]

for i in d.values():

l1.append(i)

max1=max(l1)

for i in d.keys():

if d[i]==max1:

return i

string=input()

print(max_occurance(string))

Q3. Make a function check_palindrome() that takes a list of strings as an argument. It returns the string which is a palindrome.

Input:

3

malayalam

radar

nitish

Output:

malayalam

radar

code:

def check_palindrome(lis):

palin_lis = []

for i in lis:

if i == i[::-1]:

palin_lis.append(i)

return palin_lis

lis = []

for i in range(int(input())):

lis.append(input())

for _ in check_palindrome(lis):

print(_)

Q4. Write a Python program to calculate the salary of the temporary staff using Multilevel Inheritance.

Description:

Create a class Person which contains a constructor __init__() and a method display(self). The method displays the name of the person

Create another class Staff which inherits Person. It contains a constructor __init__() and a method display(self). The method displays Id.

Create another class Temporarystaff which inherits Staff, it also contains a constructor __init__() and two method displays (self), and Salary(self).

The method Salary(self) returns the total salary earned. The method display(self) displays a number of days, hours worked and total salary earned.

salary earned = total hours worked *150

Input Format:

String => name

Integer => Id

Integer => number of days

Integer => hoursworked

Output Format:

All outputs contain strings and integers.

Sample Input:

Tilak

157934

20

8

Sample Output:

Name of Person = Tilak

Staff Id is = 157934

No. of Days = 20

No. of Hours Worked = 8

Total Salary = 24000

Case 1

Case 2

Input (stdin)

Tilak

157934

20

8

Output (stdout)

Name of Person = Tilak

Staff Id is  = 157934

No. of Days = 20

No. of Hours Worked = 8

Total Salary = 24000

Input (stdin)

Praveen

124563

26

6

Output (stdout)

Name of Person = Praveen

Staff Id is  = 124563

No. of Days = 26

No. of Hours Worked = 6

Total Salary = 23400

Code:

class employee:

def __init__(self,name,id,days,hours):

self.name = name

self.id = id

self.days = days

self.hours = hours

def display(self):

print(“Name of Person = {name}\nStaff Id is  = {id}\nNo. of Days = {days}\nNo. of Hours Worked = {hours}\nTotal Salary = {salary}”.format(name=self.name,id=self.id,days=self.days,hours=self.hours,salary=self.days*self.hours*150))

a = input()

b = int(input())

c = int(input())

d = int(input())

obj = employee(a,b,c,d)

obj.display()

Q5. Write a Python program to check the quantity of petrol in the bike using exception handling.

If there is no petrol i.e. null in the bike it should raise an exception. That exception is handled by using except block and it should print “There is no fuel in the bike”. Otherwise, it should the show quantity of petrol on the bike.

Input Format:

The input consists of a string which denotes a fuel.

Output Format:

Output is a String

Sample Input:

40

Sample Output:

Petrol Quantity = 40

Case 1

Case 2

Input (stdin)

40

Output (stdout)

Petrol Quantity =  40

Input (stdin)

NulL

Output (stdout)

There is no fuel in the Bike

Code:

a=input()

try:

if(a.lower()!=’null’):

print(“Petrol Quantity = “,a)

else:

raise ValueError

except(ValueError) :

print(“There is no fuel in the Bike”)

Q 6. Write a Python program to create a class called mobile which contains a method called display which displays the name of the mobile owner, mobile brand, colour and camera pixel.

Input Format:

String => name

String => brand name

String => color

Integer => pixel

Output Format:

Output is a String

Sample Input:

Dinesh

Lenovo vibe K5 note

gold

13

Sample Output:

Dinesh’s own Lenovo vibe K5 note gold colour smartphone has a 13 MP camera

Case 1

Case 2

Input (stdin)

Dinesh

Lenovo vibe K5 note

gold

13

Output (stdout)

Dinesh’s own Lenovo vibe K5 note gold colour smartphone has a 13 MP camera

Input (stdin)

Manoj

Vivo v11

white

21

Output (stdout)

Manoj own Vivo v11 white colour smartphone having a 21 MP camera

Code:

class mobile:

def __init__(self,owner,brand,color,camera):

self.owner = owner

self.brand = brand

self.color = color

self.camera = camera

def display(self):

print(“{owner} own {brand} {color} color smartphone having {camera} MP camera”.format(owner = self.owner,brand = self.brand,color = self.color,camera = self.camera))

a= input()

b= input()

c= input()

d= input()

obj = mobile(a,b,c,d)

obj.display()

Unlock Your Coding Potential with Our Python Programming Course – Enroll Today

Some more TCS Xplore Python coding questions & answers:

Q7. Longest Increasing Subsequence

Given an integer array ‘A’. Find the length of its Longest Increasing Subsequence of a sub-array from the given integer array. The elements are sorted in monotonic increasing order. You need to create a function that takes two inputs – integer ‘n’ and an integer array containing ‘n’ integers. To return the length of its LIS.

Format:

Input:

The integer input is ‘n’. And Integer array ‘A’ input, contains ‘n’ integers.

Output:

Return the length of its LIS.

Constraint:

1 <= input1 <= 1000

Example:

Input:

3

1, 3, 2

Output:

2

Case 1

Case 2

Input (stdin)

3

1 3 2

Output (stdout)

2

Input (stdin)

9

10 22 9 33 21 50 41 60 80

Output (stdout)

6

Code:

def lis(arr,n):

lis = [1]*n

for i in range (1, n):

for j in range(0 , i):

if arr[i] > arr[j] and lis[i]< lis[j] + 1 :

lis[i] = lis[j]+1

maximum = 0

for i in range(n):

maximum = max(maximum , lis[i])

return maximum

n=int(input())

arr = []

arr=list(map(int, input().split(‘ ‘)[:n]))

print(lis(arr,n))

Q8. Write a Python program to display the Passport details of the Person using composition.

Description:

Create a class Passport and class Person. Compose the class Passport in the class Person.

Class Passport contains constructor __init__() which sets the name, address and passport no.

Display the name of the person, Address and passport number of the person.

Input Format:

Name => String

Address => String

passport number => String

Output Format:

Three outputs. All are String

Sample Input:

RamKumar

Kollam

J7546891

Sample Output:

Name: RamKumar

Address: Kollam

Passport Number: J7546891

Case 1

Case 2

Input (stdin)

RamKumar

Kollam

J7546891

Output (stdout)

Name: RamKumar

Address: Kollam

Passport Number: J7546891

Input (stdin)

Purushothaman

Mumbai

J1535231

Output (stdout)

Name: Purushothaman

Address: Mumbai

Passport Number: J1535231

Code:

#Type your code here…

class passport:

def __init__(self,name,address,pa):

self.name=name

self.address=address

self.pa=pa

def display(self):

print(“Name :”,self.name)

print(“Address :”,self.address)

print(“Passport Number :”,self.pa)

class person(passport):

def __init__(self,name,address,pa):

super().__init__(name,address,pa)

super().display()

a=input()

b=input()

c=input()

e1=person(a,b,c)

Unlock Your Coding Potential with Our Python Programming Course – Enroll Today

The next coding question from the list of TCS Xplore Python coding questions is here:

Q9. Consider a row of n coins. We play a game against an opponent by alternative turns. In each turn, a player selects either the first or last coin from the row. Now remove it from the row permanently and take the value of a coin. Find the maximum possible amount of money.

Example:

Input:

4

5 3 7 10

Output:

15

Case 1

Case 2

Case 3

Case 6

Case 7

Case 8

Case 9

Case 10

Input (stdin)

4

5 3 7 10

Output (stdout)

15

Input (stdin)

7

8 15 3 7 10 22 5

Output (stdout)

26

Input (stdin)

8

10 3 8 2 6 7 15 1

Output (stdout)

39

Input (stdin)

5

1 2 3 4 5

Output (stdout)

9

Input (stdin)

7

11 22 33 44 55 66 88

Output (stdout)

187

Code:

 

def optimalStrategyOfGame(arr, n):

table = [[0 for i in range(n)]

for i in range(n)]

for gap in range(n):

for j in range(gap, n):

i = j – gap

x = 0

if((i + 2) <= j):

x = table[i + 2][j]

y = 0

if((i + 1) <= (j – 1)):

y = table[i + 1][j – 1]

z = 0

if(i <= (j – 2)):

z = table[i][j – 2]

table[i][j] = max(arr[i] + min(x, y),

arr[j] + min(y, z))

return table[0][n – 1]

n=int(input())

arr1 = [int(i) for i in input().split()]

print(optimalStrategyOfGame(arr1, n))

Unlock Your Coding Potential with Our Python Programming Course – Enroll Today

Conclusion

1: Which of the following data types is immutable in Python?

2: What does the len() function do in Python?

3: Which keyword is used to define a function in Python?

4: What will print(type([1, 2, 3])) output?

5: Which statement is correct about Python indentation?

    Fill out the form to see the results



    Ever wondered how much you really know? It's time to put your brain to the test!

    So, these are the best TCS Xplore Python encryption questions and answers for you. If you have any questions that you think are important but are not covered here, please share them below in the comments section. This knowledge sharing place is quickly becoming the second best destination for tech learning.

    Entri’s Online Python Programming course provides a comprehensive and structured learning experience to master Python from basics. Whether you’re a beginner or experienced, this advanced course caters to all skill levels. Learn through hands-on projects, real-world examples, and expert mentorship to build a strong foundation in Python programming. Our interactive platform ensures an engaging learning experience. Also, you get hired easily with internship and placement assistance.
    Share66SendShare

    Juwairiya Mahin

    Related Posts

    KWA Meter Reader Notification 2025: PDF, Eligibility, Salary, Application Dates
    Articles

    KWA Meter Reader Notification 2025: PDF, Eligibility, Salary, Application Dates

    September 1, 2025
    How to File Income Tax Return (ITR) on Your Own
    Articles

    How to File Income Tax Return (ITR) on Your Own

    September 1, 2025
    Kerala PSC Overseer & Draftsman Grade 3 Exam Date 2025: Admit Card, What to Carry & Instructions
    Articles

    Kerala PSC Overseer & Draftsman Grade 3 Exam Date 2025: Admit Card, What to Carry & Instructions

    September 1, 2025
    Next Post
    Best PG Diploma in Montessori Teacher Training (TTC)

    Best PG Diploma in Montessori Teacher Training (TTC)

    Different Courses Offered

    1. Full Stack Development Course
    2. Data Science Course
    3. Python Programming Course Online
    4. Data Analytics Course
    5. Ui Ux Designer Course
    6. AWS Course
    7. Flutter Training Course

    Explore More

    1. Which coding language is best for beginners
    2. Best Coding Courses with placement assistance
    3. Types of Coding Jobs and how to get hired
    4. How to learn coding at home
    5. Difference between coding and programming

    Courses

    • Data Science With GenAI
    • Ai Enhanced Full Stack Developer Course
    • AWS Solution Architect Course
    • Ai Powered Software Testing Course
    • Ai-Powered Cybersecurity Course in Kerala
    • Ai Enhanced Python Programming Course
    • Ai Powered Data Analytics Course
    • AI-Integrated UI/UX Design Course in Kerala
    • AI-Integrated Flutter Training Course in Kerala
    • Data Science Course in Kerala
    • Data Analytics Courses in Kerala
    • Full Stack Developer Course in Kerala
    • AI Powered Digital Marketing Course
    • Digital Marketing Course in Kerala
    • Practical Accounting Course
    • Structural Design Course
    • Quantity Surveying Course
    • Embedded Systems Course in Kerala
    • BIM Course
    • MEP Course
    • MEP QS Course
    • Stock Market Course
    • Stock Market Course in Malayalam
    • Stock Market Course in Tamil
    • Stock Market Course in Kannada
    • Forex Trading Course
    • Mutual Funds Course
    • Mutual Funds Course in Kerala
    • Mutual Funds Course in Tamil
    • PwC Edge : Strategic Accounting and Finance Programme
    • SAP FICO Training
    • SAP MM Training
    • SAP SD Training
    • ACCA Online Course
    • HR Management Course

    Company

    • Become a teacher
    • Login to Entri Web

    Spoken English Courses

    • Spoken English Course
    • Spoken English Course in Malayalam
    • Spoken English Course in Hindi
    • Spoken English Course in Tamil
    • Spoken English Course in Telugu
    • Spoken English Course in Kannada
    • Spoken English Course for Housewives
    • Spoken English Course for Working Professionals
    • Spoken English Course for School Students
    • Spoken English Course for College Students
    • Spoken English Course for Job Seekers
    • AI Powered Spoken English Course

    Quick Links

    • Explore Free Courses
    • Aptitude Questions
    • Articles
    • Videos
    • Entri Daily Quiz Practice
    • Current Affairs & GK
    • News Capsule – eBook
    • Preparation Tips
    • Kerala PSC Gold
    • Entri Skilling
    • Kerala PSC

    Other Courses

    • OET Coaching Classes
    • DHA Course
    • Nurse Recruitment Abroad
    • Montessori Teachers Training
    • Performance Marketing Course
    • German Language Course
    • Yoga Teacher Training Course
    • Options Trading Course
    • German Language A1 Course
    • German Language A2 Course
    • German Language B1 Course
    • German Language B2 Course
    • Diploma in Early Childhood Care and Education
    • Hospital and Healthcare Administration
    • Business Administration & Hospital Management
    • Hospital and Healthcare Administration

    Popular Exam

    • IBPS Exam
    • SBI Exam
    • Railway RRB Exam
    • Kerala PSC
    • Tamil Nadu PSC
    • Telangana PSC
    • Andhra Pradesh PSC
    • MPPSC
    • UPPSC
    • Karnataka PSC
    • Staff Selection Commission Exam
    • GATE

    © 2023 Entri.app - Privacy Policy | Terms of Service

    No Result
    View All Result
    • Kerala PSC
      • Kerala PSC General
        • Kerala PSC Exams
        • KAS Exam
        • Kerala PSC VEO Notification
        • Kerala Police SI
        • Kerala PSC LDC Notification
        • Kerala PSC Village Field Assistant Notification
        • Kerala PSC LD Typist Notification
        • Kerala PSC Food Safety Officer
        • Kerala PSC Excise Inspector Notification
        • Kerala PSC BDO Notification
        • Kerala PSC CPO Notification
        • Kerala PSC LGS Notification
        • Fire and Rescue Officer
        • Women Fire and Rescue Officer
      • Kerala PSC Teaching
        • Kerala PSC HSA
        • Kerala PSC HSST
        • KTET
        • LP/UP Assistant
        • KVS
        • Railway Teacher
      • Kerala PSC Technical
        • LSGD AE
        • Draftsman/Overseer
        • IEO
        • ATP
        • Polytechnic Lecturer
        • AE Electronics
        • Assistant Engineer
    • Banking
      • IBPS PO Notification
      • IBPS Clerk Notification
      • SBI PO Notification
      • SBI Clerk Notification
      • SBI SO Notification
      • SBI Apprentice Notification
      • Canara Bank PO Notification
      • Indian Bank PO Notification
      • RBI Assistant Notification
      • RBI Office Attendant Notification
      • IBPS RRB Notification
      • IBPS RRB Office Assistant Notification
    • Skilling
      • Coding
      • Spoken English
      • Stock Market
        • Share Market Today News
        • Share Market Analysis
      • Digital Marketing
      • Accounting Course
      • SAP
      • OET
      • German
      • IELTS
      • Quantity Survey
      • MEP
      • Structural Design
      • Montessori
      • Yoga Teaching
      • Oil and Gas
    • Courses
      • AI Powered Data Science Course
        • Data Science Malayalam
        • Data Science Course in Tamil
        • Data Science Course in Telugu
        • Data Science Training in Kochi
        • Data Science Training in Trivandrum
        • Data Science Course in Calicut
        • Data Science Training in Thrissur
      • AI Powered Data Analytics Course
        • Data Analytics Course in Malayalam
        • Data Analytics Course in Tamil
        • Data Analytics Course in Telugu
      • BIM Course in Kerala
      • Quantity Surveying Course
        • Quantity Surveyor Course in Tamil
        • Quantity Surveying Course in Telugu
        • Quantity Surveyor Course in Hyderabad
        • Quantity Surveying Course in Chennai
        • Quantity Surveying Course in Vijayawada
        • Quantity Surveying Course in Guntur
        • Quantity Surveying Course in Warangal
        • Quantity Surveying Course in Karimnagar
      • Structural Design Course
        • Steel Structure Design Course
        • RCC Design Course
      • MEP Course
        • MEP Quantity Surveying Course
        • MEP Design Course in Kerala
        • HVAC Course
        • MEP Course in Kochi
      • Embedded System Course
      • AI-Enhanced Full Stack Developer Course
        • Full Stack Development Malayalam
        • Full Stack Development Hindi
        • Full Stack Development Tamil
        • Full Stack Development Telugu
        • Full Stack Development Kannada
      • Stock Market Course
        • Stock Market Course in Malayalam
        • Stock Market Course in Tamil
        • Stock Market Course in Kannada
        • Options Trading Course
      • Mutual Funds Course
        • Mutual Funds Course in Kerala
        • Mutual Funds Course in Tamil
      • Forex Trading Course
      • Spoken English Course
        • Spoken English Course in Malayalam
        • Spoken English Course in Hindi
        • Spoken English Course in Telugu
        • Spoken English Course in Tamil
        • Spoken English Course in Kannada
      • AI-Driven Python Programming Course
      • AI Powered Flutter
      • Ui Ux Designer Course
      • AI-Powered Software Testing Course
        • Software Testing Course in Malayalam
        • Software Testing Course in Tamil
        • Software Testing Course in Telugu
      • Ai-Powered Cybersecurity Course
      • AI Powered AWS Solutions Architect Associate Course
      • PwC Edge : Strategic Accounting and Finance Programme
      • AI Powered Practical Accounting Course
        • Accounting Course in Malayalam
        • Accounting Course in Tamil
        • Tally Course
        • Taxation Course
        • UAE Accounting
        • GST Course
        • Zoho Books Training
        • GST Practitioner Course in Kerala
        • GCC VAT Course
      • ACCA Training Online
        • ACCA Course in Kerala
      • SAP Training Courses
        • SAP FICO Course
        • SAP MM Course
        • SAP SD Training
        • SAP FICO Course in Tamil
        • SAP MM Course in Tamil
      • HR Management Course
      • Performance Marketing Course
      • Mern Stack Developer Course
        • Full Stack Developer Course in Kochi
        • Full Stack Developer Course in Trivandrum
        • Full Stack Developer Course in Calicut
        • Full Stack Developer Course in Pune
        • Full Stack Developer Course in Bangalore
        • Full Stack Developer Course in Hyderabad
        • Full Stack Developer Course in Chennai
        • Full Stack Developer Course in Indore
        • Full Stack Developer Course in Jaipur
        • Full Stack Developer Course in Coimbatore
      • AI Powered Digital Marketing Training
        • Digital Marketing Course in Kerala
        • Digital Marketing Course in Kochi
        • Digital Marketing Course in Trivandrum
        • Digital Marketing Course in Calicut
        • Digital Marketing Course in Kollam
        • Digital Marketing Course in Thrissur
        • Digital Marketing Course in Kottayam
        • Digital Marketing Course in Kannur
      • Montessori Teacher Training
        • Montessori Teacher Training in Calicut
        • Montessori Teacher Training in Kochi, Ernakulam
        • Montessori Teacher Training in Trivandrum
        • Montessori Teacher Training in Kollam
        • Montessori Teacher Training in Malayalam
        • Montessori Teacher Training in Kannada
      • Other Courses
        • German Language Course
        • OET Coaching
        • DHA Course
        • MOH Exam Coaching
        • Nurses Recruitment Abroad
        • FMGE Coaching
        • ChatGPT Course
        • Forex Trading Course
        • Yoga Teacher Training Course
        • Diploma in Early Childhood Care and Education
        • Business Administration & Hospital Management Course
        • Hospital and Healthcare Administration
        • AI for Teachers Course
    • Others
      • Railway
        • RRB Technician Notification
        • RRB JE Notification
        • RRB ALP Notification
        • RRB NTPC Notification
        • RRB RPF Notification
        • RRB RPF SI Notification
        • RRB RPF Constable Notification
        • RRB Group D Notification
        • RRB RPSF SI Notification
        • RRB SSE Notification
      • SSC
        • SSC CPO Notification
        • SSC MTS Notification
        • SSC CGL Notification
        • SSC CHSL Notification
        • SSC GD Constable Notification
        • SSC Stenographer Notification
        • SSC JE Notification
        • SSC CAPF Notification
        • SSC JHT Notification
        • Delhi Police Constable Notification
        • Delhi Police SI Notification
      • GATE
      • MAT
      • KMAT
        • KMAT Kerala 2024
      • TET
        • APTET
        • CTET
        • DSSSB
        • Karnataka TET
        • Kerala TET
        • KVS
        • MPTET
        • SUPER TET
        • TNTET
        • TSTET
        • UPTET
      • UPSC
        • UPSC CAPF Notification
        • UPSC CDS Notification
        • UPSC NDA Notification
        • UPSC Civil service Notification
    • Free Learn
      • Free Courses
        • Free Coding Courses
        • Free Accounting Courses
        • Free Digital Marketing Courses
        • Engineering Upskilling Courses
        • Free Hospital Administration Courses
        • Free OET Training
        • Free SAP Courses
        • Free German Courses
        • Free IELTS Courses
        • Free Teachers Training Courses
        • Free Trading Courses
      • Question Answer
      • Aptitude Questions
      • Webinars
    • Test Prep
      • Kerala PSC Coaching
        • KPSC Degree Level Exam Preparation
        • Kerala PSC 12th Level Exam Preparation
        • Kerala PSC 10th Level Exam Preparation
        • KAS Coaching
        • Kerala PSC LDC Coaching
        • Kerala PSC LD Typist Coaching
        • Kerala PSC Fireman Coaching
        • KSFE Assistant Exam Preparation
        • Secretariat Office Attendant Coaching
        • Secretariat Assistant Coaching
        • Kerala PSC SI Exam Coaching
        • Khadi Board LDC Exam Preparation
        • Devaswom Board LDC Coaching
        • University LGS Exam Preparation
        • University Assistant Exam Coaching
        • KPSC Scientific Officer Exam Coaching
        • KPSC Probation Officer Grade II
        • KPSC Food Safety Officer Coaching
        • KWA Sanitary Chemist Coaching
        • KPSC Diary Farm Instructor Exam Coaching
        • Kerala PSC KWA Lab Assistant Exam Coaching
        • Kerala PSC ICDS Supervisor Exam Coaching
        • KPSC Finger Print Searcher Coaching
        • Kerala PSC Welfare Officer Gr. II Exam Coaching
        • KPSC Assistant Dental Surgeon Coaching
      • KPSC Teaching Exams
        • HSA Exam Preparation
        • KPSC HSA Social Science Coaching
        • KPSC HSA Physical Science Coaching
        • KPSC HSA English Coaching
        • KPSC Junior Language Teacher Hindi
        • KTET Coaching
        • SET Coaching
        • LP/UP Assistant Exam Coaching
        • HSST Exam Preparation
        • HSST Commerce Exam Coaching
        • Kerala PSC Lecturer in Diet Coaching
        • KVS PGT/TGT Coaching
      • Kerala PSC Technical Exams Coaching
        • Assistant Engineer Electrical Exam Coaching
        • Assistant Engineer Electronics Coaching
        • Assistant Engineer Mechanical Coaching
        • Kerala PSC Industries Extension Officer Coaching
        • KPSC LSGD AE Exam Coaching
        • KPSC Civil Engineering Exam Coaching
        • KPSC Mechanical Engineering Exam Coaching
        • KPSC Electrical Engineering Exam Coaching
        • KPSC Electronics Engineering Exam Coaching
        • KPSC Technical Computer Science Coaching
        • KPSC Tradesman Turning Coaching
        • Kerala PSC Overseer Exam Coaching
        • KPSC Assistant Town Planner Coaching
        • Lecturer in Polytechnic Electronics Coaching
      • Teaching Exams Coaching
        • CSIR NET Exam Coaching
        • EMRS Coaching
        • CTET Exam Online Coaching
      • IELTS Training Online
      • Bank Exam Coaching Online
        • SEBI Grade A Coaching
        • IBPS SO Online Coaching
        • IBPSC PO Online Coaching
        • IBPSC Clerk Online Coaching
        • SBI PO Coaching
        • SBI Clerk Online Coaching
        • SBI Apprentice Class
        • SBI SO Online Coaching
        • RBI Grade B Coaching
        • RBI Assistant Coaching
        • CSEB Exam Coaching
        • IBPS RRB Coaching
        • IBPS RRB PO Coaching
        • Canara Bank Po Exam Coaching
        • Kerala Gramin Bank Coaching
        • Kerala Bank Exam Coaching
        • JCI Exam Coaching
        • NABARD Grade A Coaching
        • LIC AAO Coaching Online
      • UPSC Online Coaching
        • UPSC CAPF Online Coaching
      • SSC Online Coaching
        • SSC JE Online Coaching
        • SSC CGL Coaching
        • SSC CGL AAO Coaching
        • SSC CHSL Coaching
        • SSC CGL CBI Inspector Coaching
        • SSC MTS Coaching
        • SSC Stenographer Coaching
        • SSC GD Online Coaching
      • RRB Exams Coaching
        • RRB RPF Exam Coaching
        • RRB NTPC Exam Coaching
        • RRB JE Online Coaching
        • RRB JE Electronics Coaching
        • RRB ALP Exam Coaching
        • RRB Technician Exam Coaching
      • CAT Online Coaching
      • CMAT Online Coaching
      • XAT Exam Coaching
      • GATE Online Coaching
        • GATE CE Online Coaching
        • GATE ME Online Coaching
        • GATE EE Online Coaching
      • NMAT Exam Coaching
        • AAI ATC Jr Executive Coaching
      • Cochin Shipyard Executive Trainee Coaching
      • BEL Probationary Engineer Coaching
      • HPCL Junior Executive Coaching

    © 2023 Entri.app - Privacy Policy | Terms of Service