Program to find the longest word present in a tuple in Python
In the python programming article, we are going to learn
-
program to find the longest word present in a tuple in python
Program to find the longest word present in a tuple in Python
The program is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
names = ("Devjeet","Ajit","Bulbul","Shawriya")
print("The longest name is:",max(names))
The output of the program is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
The longest name is: Shawriya
Few important tips about the program
1. In Python, we know that the max() function returns the largest number present in a list or a tuple. But the max() function can also return the longest string present in a list, if the list contains all the string elements.
2.The same process is applicable for python lists too.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :
Oct 13,2022