Looping in Python
The article discusses two mathematical puzzles involving flowers and punishments. In the first puzzle, a priest offers half of his flowers at each temple he visits and ends up with one flower. The second puzzle involves Tenali Raman, who cleverly avoids punishment by bribing security guards, resulting in no beatings after a series of halving punishments.
- ▪A priest visits 7 temples and offers half of his flowers at each, ending with one flower.
- ▪Tenali Raman bribes security guards to avoid receiving 512 belt beatings.
- ▪Both puzzles illustrate the concept of halving in mathematical scenarios.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3795010) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Sivakumar Mathiyalagan Posted on May 27 Looping in Python #codenewbie #beginners #python #algorithms Question: _A priest plucked some flowers from his garden and started visiting temples on his way home. He visited 7 temples in total. At each temple, he offered half of the flowers he had at that moment. After visiting all 7 temples and returning home, he was left with exactly one flower in his hand.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).