[Tutor] input problem

Nick Raptis airscorp at otenet.gr
Sun Aug 22 20:52:33 CEST 2010


On 08/22/2010 09:35 PM, Roelof Wobben wrote:
> Hello,
>
> I made this programm :
>
> def count_letters(n,a):
>     count = 0
>     for char in n:
>         if char == a:
>             count += 1
>     return count
> fruit=""
> letter=""
> fruit= input("Enter a sort of fruit: ")
> teller = input("Enter the character which must be counted: ")
> x=count_letters (fruit,letter)
> print "De letter", letter , "komt", x , "maal voor in het woord", fruit
>
> The problem is that I can't have the opportuntity for input anything.
> I use python 2.7 on a Win7 machine with as editor SPE.
>
> Roelof
>
You are using Python 2.x, so you should use raw_input() instead of input().

Note that in Python 3.x, raw_input() has been renamed to just input(), 
with the old 2.x input() gone.

Nick


More information about the Tutor mailing list