Wednesday, 17 December 2025

76 - Write a program in Python that takes a string as an input and displays it if its length is greater than 5.

Write a program in Python that takes a string as an input and displays it if its length is greater than 5.


# Take input from the user

text = input("Enter a string: ")


# Check length of the string

if len(text) > 5:

    print(text)

else:

    print("Length is not greater than 5")



Output:

Enter a string: Python
Python

OR

Enter a string: Ram
Length is not greater than 5

No comments:

Post a Comment