New To Python, Gurus Please Help Solve These Challenges. Thanks. - Programming (2) - Nairaland
Nairaland Forum › Science/Technology › Programming › New To Python, Gurus Please Help Solve These Challenges. Thanks. (4350 Views)
| Re: New To Python, Gurus Please Help Solve These Challenges. Thanks. by Homguy(op): 10:14pm On Sep 08, 2018 |
Homguy:Modified: So this is how i got the result i wanted using string indexing and reiteration as advised earlier. hay = 'SAYPAYLAYKAYTAY' n=3 print([hay[item:item +n] for item in range(0, len(hay), n)]) Result: ['SAY','PAY','LAY','KAY','TAY'] |
| Re: New To Python, Gurus Please Help Solve These Challenges. Thanks. by zyber(m): 1:55pm On Sep 09, 2018 |
Homguy:x = 0 while x < len(card): print card[x:x+3] x = x+3 Edit* list = [] count = 0 while count < len(card): n = card[count:count+3] list.append(n) count+=3 |
| Re: New To Python, Gurus Please Help Solve These Challenges. Thanks. by Snwokenk: 8:24am On Oct 27, 2018 |
Homguy:This is great! haven't been on Nairaland for a while. my apologies |
Python Gurus In The House Help With This Questions • Python Gurus Please Help Me With This Code. • Nairaland Should Switch To Python/django. Opinion • 2 • 3 • 4
I'm About To Start My Programming Learning Journey • Web Development Or Data Analystics • Upwork Identify Verification