Python Forum
Sentinel Controlled Loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sentinel Controlled Loop
#1
Hello Everyone,
My Professor wants us to create code using a list of at least 8 characters and by manipulating a Sentinel Controlled Loop. He wants our code to sort the list to display IncreasingLength, DecreasingLength, TheMostVowels, TheLeastVowels, CapitalizeEveryOtherCharacter, ReverseWordOrdering, and FoldWordsOnMiddleOfList. I have can't seem to get a hold of my professor so I haven't been able to figure out how to even start on putting this code together. Please help me. Thanks guys!
Reply
#2
Start by writing some pseudo code of the steps it would take for you to carry out each tasks.
Reply
#3
I feel that assignment needs to described more precisely.

"create code using a list of at least 8 characters"

>>> lst = ['a', 'b', 'c', 'f', 'g', 'h', 'i', 'j']
"He wants our code to sort the list to display IncreasingLength, DecreasingLength, TheMostVowels, TheLeastVowels, CapitalizeEveryOtherCharacter, ReverseWordOrdering, and FoldWordsOnMiddleOfList"

I can't see how it is useful to manipulate characters this way. Maybe it's list of words where word length is at least 8 characters?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#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


Possibly Related Threads…
Thread Author Replies Views Last Post
  controlled assessment help 0 2,504 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