Python Forum
Accumulator/looping problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accumulator/looping problem
#3
(Oct-15-2017, 06:24 PM)ichabod801 Wrote: I'm not sure what your if statement is supposed to do. At the moment it will just cause an error. Perhaps you mean if len(s)<= 1:?

Note that the examples given only insert between letters. Going one letter at a time isn't going to work. You need to look at pairs of letters. Have you learned zip yet? If so, zip the string to the string with the first character missing. If not, you will have to loop through the indexes of the string, pulling the current index and the next index. Then you need to check both characters to make sure they are letters, and then check their case to figure out the case of the letters op that you will insert.

Can you show me how to do so with loops (i haven't learned zip) please? or show me another example
Reply


Messages In This Thread
Accumulator/looping problem - by student8 - Oct-15-2017, 03:28 AM
RE: Accumulator/looping problem - by ichabod801 - Oct-15-2017, 06:24 PM
RE: Accumulator/looping problem - by student8 - Oct-15-2017, 09:39 PM
RE: Accumulator/looping problem - by ichabod801 - Oct-15-2017, 10:20 PM
RE: Accumulator/looping problem - by student8 - Oct-16-2017, 12:23 AM
RE: Accumulator/looping problem - by ichabod801 - Oct-16-2017, 01:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  accumulator pattern python_learner 8 7,670 Mar-10-2017, 11:11 AM
Last Post: zivoni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020