[Tutor] Python Word Problems(Student)
bob gailer
bgailer at gmail.com
Thu Oct 6 12:21:40 EDT 2016
On 10/6/2016 10:15 AM, Zeel Solanki wrote:
> def filter_long_words(words, n):
> for x in words.split():
> return filter(lambda x: len(x) > n, words)
>
> print filter_long_words(raw_input("Enter a list of words with spaces in
> between."), raw_input("Enter a number."))
raw_input() always returns a string. When you enter a number (say, 5) it
will be a string ("5").
use int() to convert that string to numeric.
More information about the Tutor
mailing list