D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> On Sat, Mar 4, 2017 at 2:20 PM, Peter Otten <__pete...@web.de> wrote:

>> "what is another way I can do 4**9 without using **?"
>>
>> sounds a lot like a homework question -- so you really have to think
>> about it yourself a bit. A few hints:
>>
>> How would you do the calculation with pen and paper?
>>
>> Can you translate that into a Python loop? What kind of loop would you
>> choose to repeat something 9 times?

> Much simpler is
> 
> 4*4*4*4*4*4*4*4*4

The idea behind the approach I suggested is to lead towards some level of 
abstraction. The for-loop can be put into a function, the exponent be given 
by the user at runtime etc...

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to