Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 4. Create a program which gets a text string from input and prints out its length.
- DO NOT use len() function and collections.
- 4.1. The same task but also ignore “white symbols” while counting length.
- """
- text=input("write text here:")
- count=0
- for letter in text:
- count=count+1
- print("first method (with white spaces) gives number of letters:" ,count)
- count=0
- for letter in text:
- if letter == ' ':
- continue
- else:
- count = count+1
- print("second method (without white spaces) gives number of letters:" ,count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement