Here is the code …
a=4
b=8.0
if a and a >0:
a=a*int(b)
print "Value:",a
The desired o/p should be 32. i am also getting the same in python console. But the same code is present in my product where instead of 32 the out put is coming as 44444444 (eight fours) i.e whatever value i’am giving to multiply with “a” it is just printing that much a’s. If you give 12 then twelve fours will print.
Any idea what is the problem ?
I bet you 100 bob that in your product
ais not actually the integer 4, but the string ‘4’.This will happen, for example, if you are using something like
a = raw_input('Please enter a number: ')and then you forget to convert the stringainto a number.