Flag control variable

Gary Herron gary.herron at islandtraining.com
Tue Feb 11 15:19:06 EST 2014


On 02/11/2014 11:55 AM, luke.geelen at gmail.com wrote:
> hey, i got another problem now,
> if i use the imterpreter to do 3 * 4 it gives twelve
> the script gives 3333?
> any tips

 >>> 3*4
12

 >>> "3"*4
'3333'


Multiplying two integers produces the result you expect.

Multiplying a *string* by an integer is what you are doing. (And it just 
repeats the string a number of times -- not what you want.)

Your code used to have int(...) to convert the string supplied by 
sys.argv into integers.  What happened to them?

Gary Herron








More information about the Python-list mailing list