[Tutor] Problem with little program
C M Caine
cmcaine at googlemail.com
Sat Mar 13 20:30:53 CET 2010
That's an easy mistake to make. Simply use raw_input instead of input.
The former will always return a string, the latter treats whatever you
enter as executable python code.
You almost never want to use input. raw_input is safer.
On 13 March 2010 18:56, Marco Rompré <marcodrompre at gmail.com> wrote:
>
> Hello I have a little problem, I am trying to define a function ligneCar(n, ca) that would print n times the caracters ca.
> For now I have the user entering a short sentence corresponding to ca.
> Here is my code:
> def ligneCar(n,ca):
> c=0
> while c<n:
> print ca
> c+=1
> ca = input ('Enter a short phrase : ')
> n = input ('Enter how many times you want : ')
> Thats the definition of my function ligne_Car
> then in another python file
> I want to recall my function ligne_Car but it is not working.
> Please help me
>
>
> --
> Marc-O. Rompré
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list