Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,162,403 members, 7,850,439 topics. Date: Tuesday, 04 June 2024 at 09:17 PM |
Nairaland Forum / Science/Technology / Programming / New To Python, Gurus Please Help Solve These Challenges. Thanks. (3870 Views)
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)
Re: New To Python, Gurus Please Help Solve These Challenges. Thanks. by Homguy(m): 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'] 1 Like |
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 |
Foundations Of Programming: Fundamentals / How Much Does It Cost To Make A Website From Scratch / Nigerian Developers Aren't Creative
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11 |