Python Exercise - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Python Exercise (1172 Views)
| Python Exercise by Nobody: 10:40pm On Oct 06, 2012 |
Hello gurus in the house.. Please any idea on how i can interchange the first and last letters of any word using python? . . E.g . 'good' = 'doog' 'soup' = 'pous' 'given' = 'niveg' . . Was thinking of using 'slice' - it didn't work. Help me out.. Just give me tips on how to go about it..don't write the program for me please.. Thanks in advance.. |
| Re: Python Exercise by Nobody: 12:51pm On Oct 07, 2012 |
since strings are lists in pythonx="good" x[-1] take the last character, minus means "start counting from the last character" x[1:-1] selects from second character to penultimate inclusive, note that index starts from zero x[0] is the first character |
| Re: Python Exercise by Nobody: 4:44pm On Oct 07, 2012 |
webdezzi: since strings are lists in pythonthanks man, I really appreciate it.. Hope you don't mind answering another question? Do you have any idea on how I can make PyGTK work on Windows? I've installed it, yet it's not working.(I tried using PyQt, but there is no good book on it). |
| Re: Python Exercise by Nobody: 5:28pm On Oct 07, 2012 |
. |
| Re: Python Exercise by Nobody: 10:46pm On Oct 07, 2012 |
i've never used gtk, the debate is usually btw wx and Qt and not gtk there are billions on Qt tutorials online, especially on youtube |
| Re: Python Exercise by Nobody: 10:40am On Oct 08, 2012 |
webdezzi: i've never used gtk,thanks man. ok.. |
| Re: Python Exercise by vokah0907: 8:14am On Oct 11, 2012 |
Hope you don't mind answering another question?[img]http://www.forexchartingsoftware.info/pc.gif[/img] |
| Re: Python Exercise by 8ightball: 7:20pm On Oct 13, 2012 |
ask away |
| Re: Python Exercise by ufumes(m): 5:22pm On Oct 27, 2012 |
Retrieve the ist character of the word assign it to a variable. Retrieve the last character and assign it to a variable. Then concatenate the last variable + the word (excluding the ist and last) + the first character |
I Need Help With This Python Exercise • INEC Voter Registration Exercise- IT Analysis • 2 • 3 • 4
Do U Use Or Know About Nodejs? Come In Please? • Database Normalization (help Please) • Using A Website To Brows for Free