in while loop:%d%i meaning?
Doubt in while loop.please explain
Hi @silpasweta,
print(" Step %d"%i)
%d
basically means this is a placeholder for variable integer value, and after the statement we use %i
to pass a int variable i to this placeholder
for eg:
initially i was 1
so it print Step 1, because %d
will be replaced by i
whose value is right now 1
in next iteration , i = 2, so %d
will be replaced by 2 so, output is Step 2
similarly for all the iterations.
Some commons used types
%d
is for integer
%s
is for strings
%f
is for float values
Thanks