Wie man in Python die Länge der Schnur bekommt
string = "test"
print(len(string))
#>>> Output "4"
Ankur
string = "test"
print(len(string))
#>>> Output "4"
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"
# to get the length of a string or array, use the len() method
my_string = "Hello World"
my_list = ["apple", "banana", "orange"]
print(len(my_string)) # outputs 11
print(len(my_list)) # outputs 3