+ 3
I want find how much words in "I am from Azerbaijan" sentence with Python. How i can do it. please.
question
4 Antworten
+ 5
print(len("I am from Azerbaijan".split()))
You print the length or the number of elements in a list created from the string by the .split() method. In other words, you count the number of words ;)
+ 6
you can do it dude with out any functions
number_word =1
for i in range 'I am from ... '
if i==' '
# ' ' is a space
number_word += 1
and if you change the string that you don't sure that is empty or not you can add a if at first program that say if string is empty number_word = 0
good luck 😉
+ 3
Dəyməz ;)
+ 2
Thanks