Python Forum
Sentinel Controlled Loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sentinel Controlled Loop
#4
def main():
# declare any necessary variable(s)


# // Loop: while the user wants to continue processing more lists of words
#
# // Loop: while the user want to enter more words (minimum of 8)
# // Prompt for, input and store a word (string) into a list
# // Pass the list of words to following functions, and perform the manipulations

# // to produce and return a new, modified, copy of the list.
# // NOTE: None of the following functions can change the list parameter it
# // receives – the manipulated items must be returned as a new list.
#
# // SortByIncreasingLength(…)
# // SortByDecreasingLength(…)
# // SortByTheMostVowels(…)
# // SortByTheLeastVowels(…)
# // CapitalizeEveryOtherCharacter(…)
# // ReverseWordOrdering(…)
# // FoldWordsOnMiddleOfList(…)
# // Display the contents of the modified lists of words
#
# // Ask if the user wants to process another list of words

This is the Psuedocode we were given to go off of. I can't seem to figure it out though. So far I've come up with
def main():
	ListofWords=[]
	numberofWords = 0
	
newWord = input("Enter next word, or 'Exit' to quit:")

	while newWord != "Exit":
		ListofWords.append(newWord)
		numberofWords = numberofWords+1	
	if numberofWords<8:
		print("There are not enough words")
	else:	
I have no idea where to go from here. Anyone have any ideas on how I'd go about writing this code?
Reply


Messages In This Thread
Sentinel Controlled Loop - by adrury2 - Mar-11-2019, 09:41 PM
RE: Sentinel Controlled Loop - by Yoriz - Mar-11-2019, 09:54 PM
RE: Sentinel Controlled Loop - by perfringo - Mar-12-2019, 08:03 AM
RE: Sentinel Controlled Loop - by adrury2 - Mar-12-2019, 10:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  controlled assessment help 0 2,538 Jun-16-2017, 05:31 PM
Last Post: help

Forum Jump:

User Panel Messages

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