[Tutor] Problem
zakaria
zemmoura.khalil at gmail.com
Sun Aug 28 19:47:01 EDT 2016
The " {} " is the place holder of the values of a, b and c argument
passed to format.
this example maybe can help to understand
print('I like the python {}'.format('mailing-list'))
will output
>>> I like the python mailing-list
The format methode will substitute the {} with the argument it takes.
if you want to insert more than one string in the string 'I like
python' you have to use multiple {}
example:
print('Il like the {} {}'.format('Python', 'mailing-list'))
will output
>> I like the python mailing-list
you can google it under the term of "string formating python" and learn
more if you want
> 1) why is it printing backwards?
it is giving that order of result because of the values that takes a,
b, c in across the different iteration.
the outer loop over the fisrt iteration gives set a to 1
the middel loop over the fisrt iteration gives set b to 1
the inner loop over the fisrt iteration gives set c to 1
and that dont give any result so the inner loop continue to run until
it sets c to 4 witch gives the result of 55.
this output is conditioned by the algorythm used
> 2) why is it skipping 51,52 and 54?
Are you shure those values are possible.
Can you give me the values of a, b and c you calculated by hand for
those different results?
regards
More information about the Tutor
mailing list