limit input length python code example
Example 1: length of string python
string = "hello"
print(len(string))
#>>> Outputs "5"
if len(string) >= 10:
print("This string is grater then 10")
if len(string) <= 10:
print("This string is smaller then 10")
# Outputs "This string is smaller then 10"
Example 2: limit for loop python
for index, item in enumerate(items):
print(item)
if index == limit:
break