Question: Pac-Man is a video game character who normally eats dots, power pellets, and the occasional ghost. Recently, he's fallen on hard times and has been

 Pac-Man is a video game character who normally eats dots, powerpellets, and the occasional ghost. Recently, he's fallen on hard times and

Pac-Man is a video game character who normally eats dots, power pellets, and the occasional ghost. Recently, he's fallen on hard times and has been reduced to eating letters of the alphabet. Pac-Man can eat most letters of the alphabet, but he is unable to digest any of the characters in the word "GHOST" (uppercase or lowercase). When he reaches one of these characters in a list, he loses his appetite and stops eating. Complete the pacman (line) function, which traces Pac-Man's progress through a list of uppercase and low- ercase letters (with no spaces, digits, or symbols) and returns the final state of the list. The initial list might be empty. Use underscores (-) to represent consumed characters and a less-than sign () to represent Pac-Man's final position (either at the very beginning or end of the list, or right before the character that stopped him). The returned value also includes any uneaten letters of the list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!