![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| When referencing a specific location of a string, you can access an individual element by putting the loction inside the []'s. You can define a range as well by separating the beginning and ending loctions with a colon. If there isn't a beginning location defined (example being the first part) and if there isn't an ending location (example being the second part), what do you think happens? -poof #10 |
| Not the whole thing. Just up to where? And what about if the colon comes second? -poof #10 |
| Not quite... It is saying start at the beginning, and go until you find the one vowel you are looking for at that point in the for loop. Then what does it do? Liz Helms |
| Helpful comment: Think of s[:x] as shorthand for s[0:x] (i.e. the part of s from the start to x) and s[x:] as a shorthand for [x:len(s)] (i.e. the rest of s from x to the end). For that matter, s[:] is an obscure way of saying s. Colin Potts |
| Curmudgeonly comment: There is a slide on this confusing (in my opinion) Python notation in the lecture on text processing. If you don't recognize something, then you may have either missed that lecture or zoned out for a couple of minutes. (It happens.) Check the your notes, the slides, the book, and answers to previous questions before asking a question. Colin Potts |
| It's inside the while loop, so even though it isn't at the very end, that doesn't mean the function will stop right after that line is done. -Blake O'Hare |
^ you forgot the u vowel, so it should be grg institte of technology
Do you refer back to the original source each time you go to the for loop and do the loc=source.find(i) or do you refer to the revised one? for example i got: i source a [6] e [1] i [5] o [2] u [14] i got different locations of the i in vowels than the previous guy because each time i referred to "georgia institute of technology" when finding the source location of (i). Is that wrong? i got the right answer "grg institte of technology" by doing it that way.