Write a function that counts the characters in a string the user inputs. Then write a routine that calls the function and displays the following output. $ ./count_letters.py Enter some words: The rain in Spain The string "The rain in Spain" has 17 characters in it.
What will be an ideal response?
$ cat count_letters.py #!/usr/bin/python def countEm(my_string):
count = 0 for s in my_string:
count += 1 return count
stg = raw_input('Enter some words: ') print 'The string \"' + stg + '\"' + ' has ', print countEm(stg), print 'characters in it.'
You might also like to view...
A JavaSpaces service provides the __________ operations.
a) read and write b) read, write and remove c) read, write and take d) read, write and put
How can you add a bullet point to text in a PDF file?
What will be an ideal response?
Windows Mobile is a closed source operating system
Indicate whether the statement is true or false
You can choose to have an animation display just once, a specified number of times, or continuously, which is called ____.
A. tweening B. auto-filling C. looping D. filtering