array[-1]
andstring[-1]
last letter and last string retrievalarray[-1]
andstring[-1]
last letter and last string retrievalI originally used
len(string/array)-1
to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readableMain inside or outside of class
I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.
play function
if,elif,else
the
if
andelif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statementsif word == ''
Not sure if unorthodox but there should be a better comparison
word.lower()
,word.strip()
,self.currentWord = word
There might be a better way of combining this?
I originally used len(string/array)-1
to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable
- Main inside or outside of class
I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.
- play function
if,elif,else
the if
and elif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements
if word == ''
Not sure if unorthodox but there should be a better comparison
word.lower()
,word.strip()
,self.currentWord = word
There might be a better way of combining this?
array[-1]
andstring[-1]
last letter and last string retrieval
I originally used len(string/array)-1
to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable
- Main inside or outside of class
I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.
- play function
if,elif,else
the if
and elif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements
if word == ''
Not sure if unorthodox but there should be a better comparison
word.lower()
,word.strip()
,self.currentWord = word
There might be a better way of combining this?
array[-1]
andstring[-1]
last letter and last string retrievalI originally used
len(string/array)-1
to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readableMain inside or outside of class
I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.
play function
if,elif,else
the
if
andelif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statementsif word == ''
Not sure if unorthodox but there should be a better comparison
word.lower()
,word.strip()
,self.currentWord = word
There might be a better way of combining this?
- Main inside or outsdteoutside of class
- Main inside or outsdte of class
- Main inside or outside of class
-Edit1-
Edit 1
Code Explanation
Code Explanation OnceOnce run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should exceptaccept a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don'ydon't match then the game goes into the 'game over' function which resets the game automatically.
Unorthodox choices:
Unorthodox choices
- array[-1]
array[-1]
and string[-1]string[-1]
last letter and last string retrieval
I originally used len(string/array)-1len(string/array)-1
to retrieve the last letter/string however. However this seems movemore visually appearingappealing but it is questionable whether it is readable
- Main inside or outsiteoutsdte of class
- play function if,elif,else
if,elif,else
the ifif
and elifelif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements
- if word == ''
if word == ''
- word.lower()
word.lower()
, word.strip() self.currentWord = wordword.strip()
,self.currentWord = word
-Edit1-
Code Explanation Once run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should except a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don'y match then the game goes into the 'game over' function which resets the game automatically.
Unorthodox choices:
- array[-1] and string[-1] last letter and last string retrieval
I originally used len(string/array)-1 to retrieve the last letter/string however this seems move visually appearing but it is questionable whether it is readable
- Main inside or outsite of class
- play function if,elif,else
the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements
- if word == ''
- word.lower(), word.strip() self.currentWord = word
Edit 1
Code Explanation
Once run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should accept a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don't match then the game goes into the 'game over' function which resets the game automatically.
Unorthodox choices
array[-1]
andstring[-1]
last letter and last string retrieval
I originally used len(string/array)-1
to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable
- Main inside or outsdte of class
- play function
if,elif,else
the if
and elif
statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements
if word == ''
word.lower()
,word.strip()
,self.currentWord = word