“Jak znaleźć długość sznurka w Pythonie bez użycia Len” Kod odpowiedzi

String Acharacters liczą się w Pythonie bez użycia Len

# User inputs the string and it gets stored in variable str
str = input("Enter a string: ")

# counter variable to count the character in a string
counter = 0
for s in str:
      counter = counter+1
print("Length of the input string is:", counter)
Healthy Hummingbird

Jak znaleźć długość sznurka w Pythonie bez użycia Len

#defining a function to find the length of a string 
def find_length_str(string):
	counter = 0
    if type(string) != str:
        print("Please enter a string...")
    else:
        for s in string:
        	counter += 1
            string += s
        return counter
        
find_length_string('ABCDEFG')
Shaurya Maharishi

Odpowiedzi podobne do “Jak znaleźć długość sznurka w Pythonie bez użycia Len”

Pytania podobne do “Jak znaleźć długość sznurka w Pythonie bez użycia Len”

Więcej pokrewnych odpowiedzi na “Jak znaleźć długość sznurka w Pythonie bez użycia Len” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu