“Python Lenght” Kod odpowiedzi

Python Len

>>> len(‘hello’)
5
>>> len(‘My very energetic monster just scarfed nachos.’)
46
>>> len(”)
0
>>> avengers = [‘hulk’, ‘iron-man’, ‘Captain-America’, ‘Thor’]
>>> len(avengers)
4
>>> names = (‘Mike’, ‘Josh’, ‘Ope’, ‘Toby’, ‘Fred’, ‘Krish’)
>>> print(len(names))
6
>>> bierce = {
… “day”: “A period of twenty-four hours, mostly misspent”,
… “positive”: “Mistaken at the top of one’s voice”,
… “misfortune”: “The kind of fortune that never misses”,
… }
>>> type(bierce)
<type ‘dict’>
>>> print(len(bierce))
3
David Cao

długość sznurka Pythona

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"
itsanantk

Długość Pythona

# 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
Attractive Aardvark

Jak len w Pythin

len(data)
Wandering Wasp

Python Lenght

len(string) 
Kaio Santos

Python Len

string = "Apollo" 
print(len(string))
Apollo

Odpowiedzi podobne do “Python Lenght”

Pytania podobne do “Python Lenght”

Więcej pokrewnych odpowiedzi na “Python Lenght” w Python

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

Przeglądaj inne języki kodu